How do I display my input (tC1, tC2) in the legend? I want the numerical value of whatever input is used, not the name tC1,tC2. This is my script
tC1=input('Enter the first temperature in °C:');
tC2=input('Enter the second temperature in °C:');
tK1=(tC1)+(273.15);
tK2=(tC2)+(273.15);
n=1;
R=8.314;
v=0:1:1000;
pkPa1=(n*R*tK1)./v;
pkPa2=(n*R*tK2)./v;
semilogx(v,pkPa1)
ylim([0 1000])
hold on;
semilogx(v,pkPa2,'--r')
ylim([0 1000])
grid on;
title('Title');
xlabel('Volume');
ylabel('Pressure');
legend(tC1,tC2);<----This is where my problem is

 Respuesta aceptada

Walter Roberson
Walter Roberson el 12 de Mzo. de 2013

1 voto

legend( num2str(tC1), num2str(tC2) )

Más respuestas (0)

Etiquetas

Preguntada:

el 12 de Mzo. de 2013

Comentada:

el 12 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by