how can i implement transfer function in embedded matlab block?

6 Ansichten (letzte 30 Tage)
Reshna
Reshna am 17 Jul. 2014
Beantwortet: MOUMITA DEY am 24 Jun. 2017
i need to generate a matlab code for a transfer function whose coefficient varies depending on frequency.In embedded matlab block i used the same way to generate transfer function code as in m-file. but it shows error.how can i implement transfer function in embedded matlab block?
  2 Kommentare
Reshna
Reshna am 19 Jul. 2014
The program is as follows;
function y = fcn(I,w) eml.extrinsic('tf')
s = tf('s'); a=0.4*w*s/(s^2+(2*w*s)+887364); b=0.4*w*s/(s^2+(2*w*s)+2464900); c=0.4*w*s/(s^2+(2*w*s)+4831204); d=0.4*w*s/(s^2+(2*w*s)+7986276);
y = I*(a+b+c+d); And the error messages are: 1) Expected either a logical, char, int, fi, single, or double. Found a MATLAB type. MATLAB types are returned from calls to the MATLAB interpreter and are not supported inside expressions. They may be used on the right-hand side of assignments and as arguments to MATLAB calls.
Function 'Embedded MATLAB Function' (#18.68.71), line 6, column 12: "s^2" 2)Undefined function or variable 'a'. The first assignment to a local variable determines its class.
Function 'Embedded MATLAB Function' (#18.196.197), line 11, column 8: "a" 3)Errors occurred during parsing of Embedded MATLAB function 'Embedded MATLAB Function'(#18) 4)Embedded MATLAB Interface Error: Errors occurred during parsing of Embedded MATLAB function 'Embedded MATLAB Function'(#18)

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Rick Rosson
Rick Rosson am 18 Jul. 2014
doc coder.extrinsic
  1 Kommentar
Reshna
Reshna am 20 Jul. 2014
The program is as follows;
function y = fcn(I,w) eml.extrinsic('tf')
s = tf('s'); a=0.4*w*s/(s^2+(2*w*s)+887364); b=0.4*w*s/(s^2+(2*w*s)+2464900); c=0.4*w*s/(s^2+(2*w*s)+4831204); d=0.4*w*s/(s^2+(2*w*s)+7986276);
y = I*(a+b+c+d); And the error messages are: 1) Expected either a logical, char, int, fi, single, or double. Found a MATLAB type. MATLAB types are returned from calls to the MATLAB interpreter and are not supported inside expressions. They may be used on the right-hand side of assignments and as arguments to MATLAB calls.
Function 'Embedded MATLAB Function' (#18.68.71), line 6, column 12: "s^2" 2)Undefined function or variable 'a'. The first assignment to a local variable determines its class.
Function 'Embedded MATLAB Function' (#18.196.197), line 11, column 8: "a" 3)Errors occurred during parsing of Embedded MATLAB function 'Embedded MATLAB Function'(#18) 4)Embedded MATLAB Interface Error: Errors occurred during parsing of Embedded MATLAB function 'Embedded MATLAB Function'(#18)

Melden Sie sich an, um zu kommentieren.


MOUMITA DEY
MOUMITA DEY am 24 Jun. 2017
how do i implement[(((1/T)*log(1+T*u))+1)/((10*(((1/T)*log(1+T*u))^3.2))+(185*(((1/T)*log(1+T*u))^2.5))+(288*(((1/T)*log(1+T*u))^0.7))+1)] as a transfer function in matlab where T is samplying time and u is gama

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by