Input argument "y" is undefined.

조회 수: 15 (최근 30일)
Nimco
Nimco 2012년 8월 10일
Hi
I am using the ode45 and I have been have one error message which I have tried to get get rid of but it still keeps coming up.
Input argument "y" is undefined.
Error in ==> trombe11 at 14
Tf1 =((y-b)-s1/Uc)*exp(-Ac*Uc*F/(m*cp))+(b+s1/Uc);
My m file program is:
function [dy] = trombe11(t,y )
Ac=0.2014;
Ar=2.2;
Aw=0.32;
Uc=3.1;
Uw=5.68;
Ut=1.03;
rho=1.23;
m =0.01353;
cp=1.003;
F=0.83;
b=8;
s1=15.68;
Tf1 =((y-b)-s1/Uc)*exp(-Ac*Uc*F/(m*cp))+(b+s1/Uc);
dy(1)=((Tf1-y)*0.011)/3.96 -((Ut*Ar+Uw*Aw)*(y-b)/(rho*cp*3.96));
The y value is the only parameter which is changing all the others are constants.
I also get a ~ sign on the t on the first line.
my ode function on the command space is:
>> yo=15;
>> tspan=[0:1:4];
>> [t,y]=ode45(@trombe11,tspan,yo);
>> plot(t,y);
The graph which I get is wrong.
Can anyone please suggest to me what I could do to eliminate this error.
Any help will be much appreciated
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 8월 15일
Could you explain further about "I also get a ~ sign on the t on the first line." ??

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

답변 (1개)

Wayne King
Wayne King 2012년 8월 10일
편집: Wayne King 2012년 8월 10일
I have no problem running this code:
yo=15;
tspan=[0:1:4];
[t,y]=ode45(@trombe11,tspan,yo);
plot(t,y)
Make sure that trombe11.m is saved in a folder that is on your MATLAB path. If you have it saved in c:\mfiles for example, then use
>>addpath 'c:\mfiles'
or the
>>pathtool
to add the folder.
As far as the plot not being correct, I don't know how we can address that without more details about what you expect to see.
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 8월 10일
Nimco replied,
Thank you for your help, I saved my work on MATLAB folder, but not MATLAB path. Are they the same thing?
I get the error reading when I press the publish icon in the m file but the program still runs.
m file
function [dy] = trombe11(t,y )
Ac=0.2014;
Ar=2.2;
Aw=0.32;
Uc=3.1;
Uw=5.68;
Ut=1.03;
rho=1.23;
m =0.01353;
cp=1.003;
F=0.83;
b=8;
s1=15.68;
Tf1 =((y-b)-s1/Uc)*exp(-Ac*Uc*F/(m*cp))+(b+s1/Uc);
dy(1)=((Tf1-y)*0.011)/3.96 -((Ut*Ar+Uw*Aw)*(y-b)/(rho*cp*3.96));
Input argument "y" is undefined.
Error in ==> trombe11 at 14
Tf1 =((y-b)-s1/Uc)*exp(-Ac*Uc*F/(m*cp))+(b+s1/Uc);
Command space
>> yo=15;
>> tspan=[0:1:4];
>> [t,y]=ode45(@trombe11,tspan,yo);
>> plot(t,y);
When I call the ode, I get a graph where y comes down with increasing time, but I am looking for the graph where y values increase with time.
Can anyone please suggest to me, what I could do solve this problem
Walter Roberson
Walter Roberson 2012년 8월 15일
Don't press the "publish" icon!

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by