The Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: User defined legend
Replies: 1   Last Post: Mar 11, 2013 7:52 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Derek Goring

Posts: 3,922
Registered: 12/7/04
Re: User defined legend
Posted: Mar 11, 2013 7:52 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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'])



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.