注册 登录
编程论坛 Matlab

简单问题:为什么说参数没有定义?

whxy 发布于 2009-08-13 09:58, 912 次点击
%filename funcforex123.m
function xdot =funcforex123(t,x,flag,R,L,C)
xdot=zeros(2,1);
xdot(1)=-R/L*x(1)-1/L*x(2)+1/L*f(t);
xdot(2)=1/C*x(1);
function in=f(t)
in=(t>0)*1;

??? Input argument "R" is undefined.

Error in ==> funcforex123 at 4
xdot(1)=-R/L*x(1)-1/L*x(2)+1/L*f(t);

请各位大大帮忙看看。
谢谢!
4 回复
#2
tancredo20052009-08-24 10:45
这个程序没有错,我运行了一下:
>> funcforex123(5,[2 5],1,3,4,3)

ans =

   -2.5000
    0.6667

>>
   你看看,再试试
#3
vfdff2009-09-03 22:40
应该是参数传入有点问题吧 ?、
#4
lovejinkui2009-09-06 16:17
lz还不懂得如何运行.m程序
#5
zhangxinwuhen2009-09-22 23:03
程序本身没有错,只是需要传入参数,这个只能作为封装函数,被别的程序引用
1