Why is my plot blank
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dumisa Ndhlovu
le 27 Oct 2022
Commenté : Dumisa Ndhlovu
le 27 Oct 2022
The entire code itself works, but when it comes to plotting, it comes out blank. I've tried to adjust the linewidth, line color, and even marker specifiers, but nothing seems to change. There is no error message displayed, so I'm unsure on how to solve this issue.This is on Matlab2022a.
Please help, all suggestions are welcomed.
P0=300; %power of the heater
n=50;% amount of gas (mol)
M=28; % Molar mass of Nitrogen gas
m=n*M;% m is the mass of the gas(g)
m1=m/1000;% m1 is the mass of the gas(Kg)
Cp=1.04*1000; %Cp is the thermal heat capacity of the gas
V=1250;% V is the volume(L) of the container
R=8.314;
N=3600;
T(1)=298;
for t=2:1:N %t is time(s)
T(t)=P0/(m1*Cp)+T(t-1); %T(t) is the temperature of the gas (K)
P(t)=((n*R*T(t))/V).*1.01325;
while P(t)>200
P(t)=P(t)-0.1*P(t);
end
end
plot(t,P(t),'r--',"linewidth", 5)
0 commentaires
Réponse acceptée
Chunru
le 27 Oct 2022
P0=300; %power of the heater
n=50;% amount of gas (mol)
M=28; % Molar mass of Nitrogen gas
m=n*M;% m is the mass of the gas(g)
m1=m/1000;% m1 is the mass of the gas(Kg)
Cp=1.04*1000; %Cp is the thermal heat capacity of the gas
V=1250;% V is the volume(L) of the container
R=8.314;
N=3600;
T(1)=298;
for t=2:1:N %t is time(s)
T(t)=P0/(m1*Cp)+T(t-1); %T(t) is the temperature of the gas (K)
P(t)=((n*R*T(t))/V).*1.01325;
while P(t)>200
P(t)=P(t)-0.1*P(t);
end
end
P
%plot(t,P(t),'r--',"linewidth", 5)
plot(T,P,'r--',"linewidth", 5)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Thermal Analysis dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!