Date: Mar 11, 2013 7:52 PM
Author: Derek Goring
Subject: Re: User defined legend

On Tuesday, March 12, 2013 12:39:15 PM UTC+13, James  wrote:
> Hello everyone, I am having difficulty in creating a legend displaying the user defined variables. In other words, on the legend I want it to display the value of tC1 and tC2. Any suggestions would be great! 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')
>
> grid on;
>
> title('Title');
>
> xlabel('Label');
>
> ylabel('Label');
>
> legend(???'Temperature 1'????,'???Temperature 2'???);


legend([Temperature 1 = ' num2str(tC1) char(176) 'C'],...
[Temperature 2 = ' num2str(tC2) char(176) 'C'])