Input argument "y" is undefined.

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 日

0 投票

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!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

質問済み:

2012 年 8 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by