I have been solving this two coupled ODE equations using ode45... Please find the attached files....
Even after defining the variable 'P'...,
I am getting an error
Undefined
function or
variable 'P'.
Error in
pair1 (line
5)
dy(1)=(P*(b^2)*v*sigma_e*((y(2)^2*sigma_e).^(-1/3))/(M^2))*exp(-Q/K*T)*sinh((sigma_e)/((M*K*T)*(b^3))*(Q/((y(2)).^2*sigma_e)).^(1/3));
Error in
@(t,y)pair1(t,y)
Error in
odearguments
(line 87)
f0 =
feval(ode,t0,y0,args{:});
% ODE15I sets
args{1} to
yp0.
Error in
ode45 (line
113)
[neq, tspan,
ntspan, next,
t0, tfinal,
tdir, y0, f0,
odeArgs,
odeFcn, ...
Error in
ruban (line
13)
[t,y]=ode45(@(t,y)pair1(t,y),tspan,initial_conditions)
%function
call
Please help me to sort out this problem by modifying the code or providing the hints...
Any help will be appreciated

 採用された回答

madhan ravi
madhan ravi 2018 年 12 月 21 日
編集済み: madhan ravi 2018 年 12 月 21 日

0 投票

Parameterize your function as below:
P=10E12;
b=0.268E-9;
Q=285;
M=3;
K=1.38E-23;
v=3.6E16;
sigma_e=200;
T=923;
ec=0.04;
c=7; %provide your value
tspan=0:0.01:70;
initial_conditions=[0.01,100]; %change the intial condition according to your values
[t,y]=ode45(@(t,y)pair1(t,y,P,Q,b,c,v,sigma_e,M,K,T,c,ec),tspan,initial_conditions) %function call
plot(t,y(:,1))
function dy=pair1(t,y,P,Q,b,c,v,sigma_e,M,K,T,c,ec) %function definition
dy=zeros(2,1);
dy(1)=(P*(b^2)*v*sigma_e*((y(2)^2*sigma_e).^(-1/3))/(M^2))*exp(-Q/K*T)*sinh((sigma_e)/((M*K*T)*(b^3))*(Q/((y(2)).^2*sigma_e)).^(1/3));
dy(2)=(1/(y(2)*ec))*((c^2)-(y(2))^2)*y(1);
end

4 件のコメント

ruban ramalingam
ruban ramalingam 2018 年 12 月 21 日
I am getting an error like this..
Function definitions are not permitted in this context...
What to do to sort out this..
ruban ramalingam
ruban ramalingam 2018 年 12 月 21 日
Are u getting any plot?? Please show the plot..
I am getting the same error like this..
Function definitions are not permitted in this context...
ruban ramalingam
ruban ramalingam 2018 年 12 月 21 日
編集済み: madhan ravi 2018 年 12 月 22 日
Error using pair1
Too many input arguments.
Error in @(t,y)pair1(t,y,P,Q,b,c,v,sigma_e,M,K,T,c,ec)
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in sunny (line 13)
[t,y]=ode45(@(t,y)pair1(t,y,P,Q,b,c,v,sigma_e,M,K,T,c,ec),tspan,initial_conditions)
%function call
madhan ravi
madhan ravi 2018 年 12 月 21 日
let me get back in a few minutes debugging it..

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

その他の回答 (1 件)

madhan ravi
madhan ravi 2018 年 12 月 21 日
編集済み: madhan ravi 2018 年 12 月 21 日

0 投票

Corrected equations , please clarify if something is not clear:
% y(1)=>epsilon
% y(2)=>sigma
%dy(1)=>equation2
%dy(2)=>equation1
dy(1)=(1./(y(2)*epsilon_c))*(sigma_is.^2-y(2).^2)*y(1);
dy(2)=((rho_m.*b.^2.*V_D.*sigma_e.*(y(2).^2.*sigma_e).^(-1/3))...
./M.^2).*exp(-Q/R.*T).*(sinh(sigma_e/(M*K*T).*b.*(G/(y(2).^2.*sigma_e).^(1/3))));

6 件のコメント

ruban ramalingam
ruban ramalingam 2018 年 12 月 22 日
Sorry sir for the late response...
Still getting the same error..
Please find the attached files...
ruban ramalingam
ruban ramalingam 2018 年 12 月 22 日
編集済み: madhan ravi 2018 年 12 月 22 日
I am ending with this following error... Please help me to sort out this error
Error using pair1
Too many input arguments.
Error in @(t,y)pair1(t,y,P,Q,b,c,v,sigma_e,M,K,T,c,epsilon_c)
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs,
odeFcn, ...
Error in sunny (line 14)
[t,y]=ode45(@(t,y)pair1(t,y,P,Q,b,c,v,sigma_e,M,K,T,c,epsilon_c),tspan,initial_conditions)
%function call
madhan ravi
madhan ravi 2018 年 12 月 22 日
Ruban Ruban slow down.. alright! first verify the equations properly in this answer with lates equations that you attached.
ruban ramalingam
ruban ramalingam 2018 年 12 月 22 日
Sorry sir..
y(1) should be sigma..
y(2) should be epsilon sir...
Please see the attached equations
madhan ravi
madhan ravi 2018 年 12 月 22 日
編集済み: madhan ravi 2018 年 12 月 22 日
To avoid confusions further let me rephrase.
  • Please see this answer (the equations) and create a pdf with all the necessary details (meaning the datas) of the variables according to the answer provided.
  • Let know of the intial conditions.
  • Let know of the time span.
  • Upload the latex form of the equations which is elligible to read unlike now.
If you fulfill all the above requirements then a well suitable solution can be attained sooner than expected.
ruban ramalingam
ruban ramalingam 2018 年 12 月 23 日
Sir,
Do you need the article?? ..
I attached that article having necessary details which I tried to implement... Please see the article..
Another thing
Typically I ended with this error whenever I am trying to solving any ode equations using ode45.. I am not clear with the syntax of ode45.. Eventually I want to optimising the variables using optimisation toolbox..
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs,
odeFcn, ...
Will you help me in understanding this??
I am not clear with the syntax of ode45.. Eventually I want to optimise the variables using optimisation toolbox..

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by