how can I display an equation with the constants in the title
Show older comments
for example:
title(['something something is' num2str(n=n1*e^(ax))])
Answers (1)
Geoff Hayes
on 18 May 2015
n = 12;
n1 = 13.3;
ax = 42.42;
['something something is ' sprintf('%f=%f*e^(%f)',n,n1,ax)]
would produce the string
something something is 12.000000=13.300000*e^(42.420000)
You can do a better job of the formatting if you know if n, n1 and ax are integers are floats and (if the latter) how many digits after the decimal you wish to display. See format specification for sprintf for more details.
1 Comment
Walter Roberson
on 18 May 2015
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!