I just want to plot these two graphs on top of each other! When I run, I get one but not both. Thank you!

2 vues (au cours des 30 derniers jours)
clear all;
close all;
clc;
% Fin Configuration: A
T_s = 500; % [K]
T_inf = 350; % [K]
L = 0.2; % [m]
ST_k = 14.9; % [W/m*K]
U_inf = 10; % [m/s]
D = 0.002; % [m]
nu = 29.4*10^-6; % [m^2/s]
Pr = 0.688; % no units
Re = (U_inf*D)/(nu); % no units
h = ((((0.664*(Re)^(1/2))*((Pr)^(1/3)))*(ST_k))/(L)); % [W/m^2*K]
P = pi*D; % [m]
A_a = pi*D*L; % [m^2]
m = sqrt((h*P)/(ST_k*A_a)); % [1/m]
x = linspace(0,0.15); % [0 to 15cm] or [0 to 0.15m]
Q_a = sqrt(h*P*ST_k*A_a)*(T_s - T_inf)*tanh(m*L); % [W] or [J/s]
T_a = 6.3763*cosh(m*(L-x))+350; % [K]
% Fin Configuration: B
T_s = 500; % [K]
T_inf = 350; % [K]
L = 0.2; % [m]
ST_k = 14.9; % [W/m*K]
U_inf = 10; % [m/s]
D_b = sqrt(0.25*pi*(D^2)); % [m]
nu = 29.4*10^-6; % [m^2/s]
Pr = 0.688; % no units
Re_b = (U_inf*D_b)/(nu); % no units
h_b = ((((0.664*(Re_b)^(1/2))*((Pr)^(1/3)))*(ST_k))/(L)); % [W/m^2*K]
P_b = 4*D; % [m]
A_b = 4*D*L; % [m^2]
m_b = sqrt((h*P)/(ST_k*A_b)); % [1/m]
x = linspace(0,0.15); % [0 to 15cm] or [0 to 0.15m]
Q_b = sqrt(h*P*ST_k*A_b)*(T_s - T_inf)*tanh(m*L); % [W] or [J/s]
T_b = 6.3763*cosh(m*(L-x))+350; % [K]
figure('Name','Fin A Temp. v. Length')
plot(x,T_a,x,T_b);
hold on;
set(0,'DefaultAxesFontName','Times New Roman');
title('Temperature v. Distance');
xlabel('Distance (m)','FontWeight','bold','FontSize',10);
ylabel('Temperature (K)','FontWeight','bold','FontSize',10);
grid on;

Réponses (1)

KSSV
KSSV le 9 Juil 2022
You are getting two plots, but your T_a abd T_b are exactly equal. Thats why they are lying one above the other.
clear all;
close all;
clc;
% Fin Configuration: A
T_s = 500; % [K]
T_inf = 350; % [K]
L = 0.2; % [m]
ST_k = 14.9; % [W/m*K]
U_inf = 10; % [m/s]
D = 0.002; % [m]
nu = 29.4*10^-6; % [m^2/s]
Pr = 0.688; % no units
Re = (U_inf*D)/(nu); % no units
h = ((((0.664*(Re)^(1/2))*((Pr)^(1/3)))*(ST_k))/(L)); % [W/m^2*K]
P = pi*D; % [m]
A_a = pi*D*L; % [m^2]
m = sqrt((h*P)/(ST_k*A_a)); % [1/m]
x = linspace(0,0.15); % [0 to 15cm] or [0 to 0.15m]
Q_a = sqrt(h*P*ST_k*A_a)*(T_s - T_inf)*tanh(m*L); % [W] or [J/s]
T_a = 6.3763*cosh(m*(L-x))+350; % [K]
% Fin Configuration: B
T_s = 500; % [K]
T_inf = 350; % [K]
L = 0.2; % [m]
ST_k = 14.9; % [W/m*K]
U_inf = 10; % [m/s]
D_b = sqrt(0.25*pi*(D^2)); % [m]
nu = 29.4*10^-6; % [m^2/s]
Pr = 0.688; % no units
Re_b = (U_inf*D_b)/(nu); % no units
h_b = ((((0.664*(Re_b)^(1/2))*((Pr)^(1/3)))*(ST_k))/(L)); % [W/m^2*K]
P_b = 4*D; % [m]
A_b = 4*D*L; % [m^2]
m_b = sqrt((h*P)/(ST_k*A_b)); % [1/m]
x = linspace(0,0.15); % [0 to 15cm] or [0 to 0.15m]
Q_b = sqrt(h*P*ST_k*A_b)*(T_s - T_inf)*tanh(m*L); % [W] or [J/s]
T_b = 6.3763*cosh(m*(L-x))+350; % [K]
isequal(T_a,T_b)
ans = logical
1
figure('Name','Fin A Temp. v. Length')
plot(x,T_a,'r',x,T_b,'.b');
hold on;
set(0,'DefaultAxesFontName','Times New Roman');
title('Temperature v. Distance');
xlabel('Distance (m)','FontWeight','bold','FontSize',10);
ylabel('Temperature (K)','FontWeight','bold','FontSize',10);
grid on;

Catégories

En savoir plus sur Author Block Masks dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by