simulink error
이전 댓글 표시
Hi, I have a simulink error : "Error in 'model/S-Function' while executing MATLAB S-function 'polinomf', flag = 1 (derivatives), at time 0.0." and do not know anythink about it. Can someone help me? This is the code:
function [sys, x0] = simulink(t,x,u,flag)
if flag == 0
sys = [1 0 1 2 0 0];
x0 = [1];
TS = [-1 0];
elseif flag == 1
Ka=10^-4.75;
Kw=10^-14;
w=Xb-Xa;
w1=Ka*w;
z=-Kw*Ka;
y=w1-Kw;
x=Ka+Xb;
p=[1 x y z];
n=roots(p);
if n(1)>0 r=n(1);
else if n(2)>0 r=n(2);
else r=n(3);
end
end
ph=-log10(r);
pH=ph';
sys = pH;
elseif flag == 3
sys = x;
else
sys = [];
end
Thank you
채택된 답변
추가 답변 (1개)
Fangjun Jiang
2011년 9월 29일
0 개 추천
Why do you define your function as "simulink"? It sounds like you are using the Simulink toolbox if you are talking about S-function. Should it cause confusion or even problem?
카테고리
도움말 센터 및 File Exchange에서 Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!