how can i implement transfer function in embedded matlab block?

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 commentaires

What is the error message?
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)

Connectez-vous pour commenter.

Réponses (2)

doc coder.extrinsic

1 commentaire

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)

Connectez-vous pour commenter.

MOUMITA DEY
MOUMITA DEY le 24 Juin 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

Catégories

En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by