Trying to solve a 2nd order ODE discretely , that requires external input. What am I doing Wrong ?
Mostra commenti meno recenti

Above is the ODE, I am trying to solve.Pr, and f are external inputs. Pr ,Prandtl Number is a and decimal from 0 to 1. While f is a vector obtained from a previous ODE. But, I am receiving this error in Matlab: Error using odearguments (line 92) @(X,Y)TSTAR(X,Y,A,B) returns a vector of length 27, but the length of initial conditions vector is 2. I know the problem is being caused by f, is there a way to fix this?
if true
Eqnold= @(x,y) [y(2);y(3);-y(1).*y(3).*.5];
[eta,f]=ode45(Eqnold,[0:0.4:10],[0;0;0.3320]);
%--------------------------------------------------------------------------
Tstar=@(x,y,A,B) [y(2); -0.5*A.*B.*y(2)];
A = 0.6;
B = f(:,1);
tspan = 0:0.4:10;
y0 = [0 0.332*A^(1/3)];
[t,y] = ode45(@(x,y) Tstar(x,y,A,B), tspan, y0);
plot(1-y(:,1),t/5)
end
Thanks for the help in advance!
2 Commenti
Torsten
il 2 Mag 2016
Why don't you solve all equations simultaneously ?
Best wishes
Torsten.
Noor Ahmad
il 2 Mag 2016
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!