solving pohlhausen equation,how I can write true function?
Show older comments
I write this function for solve pohlhausen equation.(T''+Pr/2 F T'=0 ) That F is output of blasius equation( 2F'''+FF''=0).but my code has error.how I can write true function?
function [Tetadot,fdot]=pohlhausen(eta,Teta,f);
fdot=blasius(eta,f);
Tetadot(1)=Teta(2);
Tetadot(2)=-(0.7/2)*f(1)*Teta(2);
Tetadot=Tetadot';
function fdot=blasius(eta,f);
fdot(1)=f(2);
fdot(2)=f(3);
fdot(3)=-(1/2)*f(1)*f(3);
fdot=fdot';
end
end
2 Comments
mahdi etminan
on 6 Jun 2019
Torsten
on 6 Jun 2019
You'll have to solve both equations (Blasius and Pohlhausen) together, not one after the other.
Answers (1)
Star Strider
on 6 Jun 2019
If you have the Symbolic Math Toolbox, let it do the programming for you:
% % 2F'''+FF''=0
% % T''+Pr/2 F T'=0
syms F(t) Pr T(t) t Y
Blasius = 2*diff(F,3)+F*diff(F,2) == 0;
Polhausen = diff(T,2) + Pr/2 * F * diff(T) == 0;
[VF,Sbs] = odeToVectorField(Blasius, Polhausen) % Vector Field Representation & Substitutions
polhfcn = matlabFunction(VF, 'Vars',{t,Y,Pr}) % Anonymous Function
varcell = sym2cell(Sbs); % Cell Array Of Substitutions
varstr = sprintfc('%s',[varcell{:}]); % Cell Array Of Substitution Strings (For ‘legend’ Or Other Uses), Can Also Use The ‘compose’ Function
producing:
polhfcn = @(t,Y,Pr) [Y(2);Pr.*Y(2).*Y(3).*(-1.0./2.0);Y(4);Y(5);Y(3).*Y(5).*(-1.0./2.0)];
and other information.
You would define a value for ‘Pr’ in your workspace, then use the function (in ode45, for example, although I have no idea what solver is most appropriate here):
[t,y] = ode45(@(t,Y)polhfcn(t,Y,Pr), tspan, ics);
Check to be sure I entered the equations correctly. I believe I did, although it is always appropriate to check.
Categories
Find more on Data Type Identification 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!