# Why aren't my lines showing up on my graph?

1 visualizzazione (ultimi 30 giorni)
Ananya Hota il 10 Giu 2020
Commentato: Walter Roberson il 10 Giu 2020
GN = input('What is the name of the gas?', 's')
hold on
IP = input('What is the initial pressure in the tank measured at 270K, in [atm]')
hold on
GT = input('the temperature of interest, in a range of 270 – 480K')
hold on
%Nitrogen
Nitrogen_P=2.5
Nitrogen_V=12
Nitrogen_T=270
Nitrogen_R=0.0821
Nitrogen_N=(Nitrogen_P*Nitrogen_V)/(Nitrogen_R*Nitrogen_T)
%Oxygen
Oxygen_P=4
Oxygen_V=15
Oxygen_T=270
Oxygen_R=0.0821
Oxygen_n=(Oxygen_P*Oxygen_V)/(Oxygen_R*Oxygen_T)
plot (GT, IP, 'r--')
hold on
plot (Nitrogen_T,Nitrogen_P, 'k--')
hold on
plot (Oxygen_T,Oxygen_P, 'b-')
hold on
xlim([250 500])
ylim([0 inf])
grid on
legend('GN','Nitrogen','Oxygen')
xlabel ('Temperature (T) [K]')
ylabel ('Pressure (P) [atm]')
title ('Pressure Change by Temperature')
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Tommy il 10 Giu 2020
Specify a marker to show scalar values. For example, a circle:
plot (GT, IP, 'ro')
Or are you trying to plot a range of pressures over a range of temperatures, for each gas?
##### 2 CommentiMostra NessunoNascondi Nessuno
Ananya Hota il 10 Giu 2020
It's a range of values. The graph should depict 3 separate positive linear lines.
Walter Roberson il 10 Giu 2020
You only work with scalars. You cannot have lines unless you work with non-scalars.

Accedi per commentare.

### Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by