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

 Réponse acceptée

Star Strider
Star Strider le 29 Avr 2020
Solving for ‘T’ is straightforward basic algebra:
yd = [0.00 0.01 0.02 0.03 0.04 0.05]
Tfcn = @(y) (1.5*y/d_x-0.5*(y/d_x).^3) * (T_inf-T_s) + T_s;
figure(2)
plot(Tfcn(yd),yd);
title ('y as a function of T')
figure(3)
plot(yd,Tfcn(yd));
title ('T as a function of y')
.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by