Path: news.mathworks.com!not-for-mail
From: "Steven_Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Putting text containing variables into plot
Date: Wed, 24 Apr 2013 17:10:42 -0400
Organization: MathWorks
Lines: 38
Message-ID: <kl9hoi$rt9$1@newscl01ah.mathworks.com>
References: <kl98f9$qkq$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: ah-slord.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="UTF-8";
	reply-type=response
Content-Transfer-Encoding: 7bit
X-Trace: newscl01ah.mathworks.com 1366837842 28585 172.28.9.169 (24 Apr 2013 21:10:42 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 24 Apr 2013 21:10:42 +0000 (UTC)
In-Reply-To: <kl98f9$qkq$1@newscl01ah.mathworks.com>
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Xref: news.mathworks.com comp.soft-sys.matlab:794282



"Kian " <kianian@gmail.com> wrote in message 
news:kl98f9$qkq$1@newscl01ah.mathworks.com...
> How can I put a text into my plot which passes computed values in there?
> For instance, I have computed my parameters to be:
>
> pars =
>    0.0005    42.1963
>
> Now I want to put a text in an appropriate position in my plot (where it 
> does not block the figure content), and pass pars(1) and pars(2) in there.
>
> My formula is omega(d) = exp(-pars(1)*d^pars(2))
>
> So, I want to have Matlab to put that for me in the plot as:
>
> omega(d) = exp(-0.0005*d^pars(2))
>
> I have already tried to put it in the title by:
> title([ '\omega(d)=exp (' , num2str(pars(1),'%4.5f') , ' d^' , 
> (num2str(pars(2))), ')' ])
>
> But still, the problem is pars(2) is not completely powered, and only its 
> first digit (4) is powered.

Yes. You will need to group the string representation of the number in curly 
braces in order for TeX to treat it all as the text that should be included 
in the superscript. Compare:

title('x^{17} and y^17')

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com