ode45- must return a column vector (Thanks in advance for help)
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
Accepted Answer
More Answers (0)
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!