[問題] sfunction的設定問題

作者: Giliher (阿莫)   2014-04-30 21:51:05
我在基本的設定參數的設定如下
function [sys,x0,str,ts] = plant(t,x,u,flag,functionN)
%CSFUNC An example M-file S-function for defining a continuous system.
% Example M-file S-function implementing continuous equations:
% x' = Ax + Bu
% y = Cx + Du
%
% See sfuntmpl.m for a general S-function template.
%
% See also SFUNTMPL.
% Copyright 1990-2001 The MathWorks, Inc.
% $Revision: 1.8 $
vcc=24;
R=1.452826565;
L=0.001282283;
ke=0.035606324;
kt=0.028228647;
kf=0.000016585;
J=0.000152052;
A0=[-R/L 0;0 -kf/J];
A1=[0 -ke/(2*L);kt/J 0];
B=[1/(2*L);0];
C=[0 1];
D=[0];
A=A0+A1*functionN;
switch flag
functionN是一個時變的參數,然後simulink model如圖
http://imgur.com/JJNthQh
可是這樣我在執行的時候程式碼的時候,就會出現
??? Input argument "functionN" is undefined.
Error in ==> plant at 28
A=A0+A1*functionN;
不知道如何解決 請各位幫幫忙 謝謝

Links booklink

Contact Us: admin [ a t ] ucptt.com