ode45- must return a column vector (Thanks in advance for help)
1 view (last 30 days)
Show older comments
iSCRIPT
function dMdx=s(x,M,gamma_b,a1Vec,b1Vec,xVec)
a1=interp1(a1Vec,xVec);
b1=interp1(b1Vec,xVec);
dMdx= M*((1+((gamma_b-1)/2)*M^2)/(1-M^2))*(-a1+((1+(gamma_b*M^2))/2)*b1);
end
COMMAND WINDOW
>> x=0:0.001:0.35;
xVec=0:0.01:0.35;
xi=xVec(1);
x4=xVec(end);
gamma_b=1.36;
X=((x-xi)/(x4-xi));
a3=0.0038;
A=a3*(1+X);
a=gradient(A,x);
a1Vec=a./A;
tau_b=1.4;
theta=2;
Tt2=2200;
Ttx=Tt2*(1+(tau_b-1)*((theta*X)./(1+(theta-1)*X)));
b=gradient(Ttx,x);
b1Vec=b./Ttx;
initial_M=2;
[x,M]=ode45(@(x,M)s(x,M,gamma_b,a1Vec,b1Vec,xVec),[xi x4],initial_M);
plot(x,M)
Error using odearguments (line 90)
@(X,M)S(X,M,GAMMA_B,A1VEC,B1VEC,XVEC) must return a column vector.
Error in ode45 (line 113) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
end
0 Comments
Accepted Answer
Torsten
on 10 Jul 2015
The function must look like
function dMdx=s(x,M,gamma_b,a1Vec,b1Vec,xVec)
a1=interp1(xVec,a1Vec,x);
b1=interp1(xVec,b1Vec,x);
dMdx= M*((1+((gamma_b-1)/2)*M^2)/(1-M^2))*(-a1+((1+(gamma_b*M^2))/2)*b1);
end
Best wishes
Torsten.
0 Comments
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!