how can i implement transfer function in embedded matlab block?

조회 수: 1 (최근 30일)
Reshna
Reshna 2014년 7월 17일
답변: MOUMITA DEY 2017년 6월 24일
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
Rick Rosson
Rick Rosson 2014년 7월 18일
What is the error message?
Reshna
Reshna 2014년 7월 19일
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)

댓글을 달려면 로그인하십시오.

답변 (2개)

Rick Rosson
Rick Rosson 2014년 7월 18일
doc coder.extrinsic
  댓글 수: 1
Reshna
Reshna 2014년 7월 20일
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)

댓글을 달려면 로그인하십시오.


MOUMITA DEY
MOUMITA DEY 2017년 6월 24일
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

카테고리

Help CenterFile Exchange에서 String에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by