## Help: Finds difficult in solving this coupled ordinary differential equations using ODE45 ??

ruban ramalingam

### ruban ramalingam (view profile)

さんによって質問されました 2019 年 6 月 26 日

さんによって コメントされました 2019 年 6 月 26 日
I have been solving these coupled ordinary differential equations using ODE45
Function file (first file)
function dy=pair1(t,y)
dy=zeros(3,1);
dy(1)=(a/(1-y(3)).^b*sigma*(1-y(2))*coth(b*sigma*(1-y(2)))*sinh(b*sigma*(1-y(2))));
dy(2)=(hstress/sigma)*(1-(y(2)/hstar))*((a/(1-y(3)).^b*sigma*(1-y(2))*coth(b*sigma*(1-y(2)))*sinh((b*sigma*(1-y(2))))));
dy(3)=d*(a/(1-y(3)).^b*sigma*(1-y(2))*coth(b*sigma*(1-y(2))))*sinh(b*sigma*(1-y(2)));
end
Second file
a=0.2044e-6;
b=0.1855e-1;
d=1;
hstress=0.4285e05;
hstar=0.5113;
T=503;
sigma=180;
tspan=0:0.01:70;
initial_conditions=[0;0;0]; %change the intial condition according to your values
[t,y]=ode45(@(t,y)pair1(t,y),tspan,initial_conditions) %function call
plot(t,y)
Ended up in the following error:
Undefined function or variable 'a'.
Error in pair1 (line 3)
dy(1)=(a/(1-y(3)).^b*sigma*(1-y(2))*coth(b*sigma*(1-y(2)))*sinh(b*sigma*(1-y(2))));
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 Untitled6 (line 11)
[t,y]=ode45(@(t,y)pair1(t,y),tspan,initial_conditions) %function call
Please anyone help me to sort out this problem..

#### 0 件のコメント

サインイン to comment.

## 1 件の回答

### Torsten (view profile)

2019 年 6 月 26 日

Put the constants (a,b,d,..) in your first file.