ODE45 error, "inputs must be scalar and square"
2 views (last 30 days)
Show older comments
Running my code is giving me this error:
"??? Error using ==> mpower Inputs must be a scalar and a square matrix.
Error in ==> marchup at 11 Mu=(Mi/(1-Mi^2))*(-((1+(((gam-1)/2)*Mi))/A)*dA+((2*gam*(Mi^2)*((1+((...
Error in ==> odearguments at 110 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> combflow at 66 [Xu, Mu]=ode45(@marchup,[xs,0],[1, Mi], f);"
Here's the ODE function:
function Mu=marchup(X, Mi, f)
Dt=5/100;
gam=1.4;
L=2;
D=2*Dt*(1+.5*cos((pi/L)*X));
A=(pi/4)*D^2;
dD=-(pi/L)*Dt*sin((pi/L)*X);
dA=(pi/4)*dD^2;
Mu=(Mi/(1-Mi^2))*(-((1+(((gam-1)/2)*Mi))/A)*dA+((2*gam*(Mi^2)*((1+((... (gam-1)/2)*Mi^2)*f)/D))));
end
How I'm calling it:
Mi=1-Bp*(xs-x(j-1));
[Xu, Mu]=ode45(@marchup,[xs,0],[1, Mi], f);
Where xs is the sonic point in a flow and x(j-1) is the point just before that.
Answers (1)
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!