Search All of the Math Forum:

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

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

Topic: Plot multiple lines with their values
Replies: 2   Last Post: Oct 24, 2012 6:02 AM

 Messages: [ Previous | Next ]
 Adam Chapman Posts: 172 Registered: 1/12/09
Re: Plot multiple lines with their values
Posted: Oct 24, 2012 6:01 AM

On Wednesday, October 24, 2012 10:10:09 AM UTC+1, Idra wrote:
> Hi!
>
> I want to decrease the value of each point to 4 decimal places only from the plot, but I dont know how to do it. This is what i've done.Thanks for helping!
>
>
>
> clear
>
> figure
>
>
>
> x=3.6330;
>
> y1=0.9787;
>
> y2=0.9743;
>
> y3=0.9577;
>
> plot(x,y1,'.-','MarkerSize',15)
>
> hold all
>
> plot(x,y2,'*-','MarkerSize',10)
>
> plot(x,y3,'+-', 'MarkerSize',10)
>
>
>
> title('Comparison of power, n=7, outlier=10{\sigma},{\alpha}=0.15')
>
> hleg1 = legend('Lenth', 'Dong', 'Berk & Piacard',2);
>
> set(hleg1,'FontSize',7)
>
> set(hleg1,'FontAngle','italic')
>
> strValues = strtrim(cellstr(num2str([x(:) y1(:)],'(%f,%f)')));
>
> text(x,y1,strValues,'VerticalAlignment','bottom');
>
> strValues = strtrim(cellstr(num2str([x(:) y2(:)],'(%f,%f)')));
>
> text(x,y2,strValues,'VerticalAlignment','bottom');
>
> strValues = strtrim(cellstr(num2str([x(:) y3(:)],'(%f,%f)')));
>
> text(x,y3,strValues,'VerticalAlignment','bottom');
>
> xlabel('Contrasts')
>
> ylabel('Power')

this code rounds a number to 3dp:
a=rand(1)
a_rounded=round(a*1000)/1000
string=num2str2num(a_rounded)

Date Subject Author
10/24/12 Idra