Is there a difference between an embedded function implementation in simulink and the m file code implementation?
古いコメントを表示
I used the embedded matlab function to implement the following code:
function [y1,y2,y3] = fcn(u,t,I,d)
%#eml
Ts=0.3;
Td=I/1000-Ts;
Ca=0.48;
u=u/Ca;
y1=d*exp(-Ts/(Ca*t)) +u*Ts;
y2=y1*exp(-Td/(Ca*t));
num1=(1/3)*y1;
num2=(2/3)*y2;
y3=num1+num2;
end
I copied these lines into a regular m file and the results did not match. (with the values I=1000,u=80.5,t=4,d is the second output y2 so i only set an initial value of 60). Although i did not set an initial value in the simulink code (don't know how) but it shouldn't matter.
I do not understand why there is a difference in the results. Thanks, Hadas
回答 (1 件)
Kaustubha Govind
2013 年 4 月 5 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Simulink についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!