Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
plotting graph -- y axis format

Subject: plotting graph -- y axis format

From: Bilal

Date: 7 Aug, 2012 16:57:25

Message: 1 of 2

I am trying to plot graph for the following x, y arrays where y is the function of x. x=[1 2 3 4 5 6 7 8 9 10] and y = [0.8500 0.8498 0.8359 0.8228 0.8155 0.8337 0.8300 0.8261 0.8201 0.8153].

When i plot the graph with the command plot(x,y) it shows four digits after the decimal point on the graph but I am interested only in the first digit after the decimal point.
Furthermore, I do not want to make any changes to the format of the results i obtain from the formula as shown in the array y above.
Thanks in advance for help.
--
bilal

Subject: plotting graph -- y axis format

From: Steven_Lord

Date: 7 Aug, 2012 17:04:45

Message: 2 of 2



"Bilal" <bilalcisco@googlemail.com> wrote in message
news:29c55c5f-b151-4add-85ee-149f20daa1d6@googlegroups.com...
> I am trying to plot graph for the following x, y arrays where y is the
> function of x. x=[1 2 3 4 5 6 7 8 9 10] and y = [0.8500 0.8498
> 0.8359 0.8228 0.8155 0.8337 0.8300 0.8261 0.8201
> 0.8153].
>
> When i plot the graph with the command plot(x,y) it shows four digits
> after the decimal point on the graph but I am interested only in the first
> digit after the decimal point.
> Furthermore, I do not want to make any changes to the format of the
> results i obtain from the formula as shown in the array y above.
> Thanks in advance for help.

Use SPRINTF to generate the tick labels in the format you desire, then use
SET to set the YTickLabel property of the axes to the generated string(s).

http://www.mathworks.com/help/techdoc/creating_plots/f1-19798.html#f1-16587

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

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us