Solving for a single unknown and plotting.
Show older comments
I need to plot the following equation where T is temperature and yd is a distance, as T vs y
(T-T_s)/(T_inf-T_s) = 1.5*yd/d_x-0.5*(yd/d_x)^3;
The entire code reads:
t0=0; tf=7;
Pr = 0.6;
y0=[0 0 0.332 0 0.332*Pr^(1/3)]';
[t,y]=ode45(@ydotcalc,[t0 tf],y0);
figure(1)
plot(t,y);grid on
U_inf = 1; %Free stream velocity
T_s = 300; %Surface temperature Celsius
T_inf = 27; %Ambient temperature
v = 30E-6; %m^2/s
x = 0.5; %distance (m)
Re_x = U_inf*x/v; %Reynolds
d_x = 5*x/sqrt(Re_x);
T = @(y) ((sqrt(U_inf*v*x)*y)-T_s)/(T_inf-T_s);
yd = [0.00 0.01 0.02 0.03 0.04 0.05]
(T-T_s)/(T_inf-T_s) = 1.5*yd/d_x-0.5*(yd/d_x)^3;
figure(2)
plot(T,yd);
function ydot = ydotcalc(t,y)
Pr = 0.6;
ydot = zeros(5,1);
ydot(1) = y(2);
ydot(2) = y(3);
ydot(3) = -0.5*y(1)*y(3);
ydot(4) = y(5);
ydot(5) = -0.5*Pr*y(1)*y(5);
end
How can I solve the equation and plot the results?
Thanks
1 Comment
Star Strider
on 29 Apr 2020
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!