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:
ploting data

Subject: ploting data

From: Erik L

Date: 7 Jan, 2011 09:46:05

Message: 1 of 2

Hi all,

Here is my simple code:
i have two vectors:
x=[1 2 3 4 5 6 7 8 9 10 11 12];
y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];
plot(x,y);

when i plot, i see the range of values from 0.71(min) and 0.99(max) on the y-axis.
i wan to see the graph in a shape that the y-axis should also show the values marks 0,0.3,0.6.0.7. I know that these values are not defined in my vector, but what i need that these values should be present along the y-axis.

there should be some way, please help.

thanks

Subject: ploting data

From: Wayne King

Date: 8 Jan, 2011 15:58:04

Message: 2 of 2

"Erik L" wrote in message <ig6nct$ghk$1@fred.mathworks.com>...
> Hi all,
>
> Here is my simple code:
> i have two vectors:
> x=[1 2 3 4 5 6 7 8 9 10 11 12];
> y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];
> plot(x,y);
>
> when i plot, i see the range of values from 0.71(min) and 0.99(max) on the y-axis.
> i wan to see the graph in a shape that the y-axis should also show the values marks 0,0.3,0.6.0.7. I know that these values are not defined in my vector, but what i need that these values should be present along the y-axis.
>
> there should be some way, please help.
>
> thanks

Hi Erik, I think it's a little unclear what you mean by: " I know that these values are not defined in my vector, but what i need that these values should be present along the y-axis."

Are you simply saying you want the y-axis to extend from 0 and set the y-ticks?

If that is the case, you can simply do:

x=[1 2 3 4 5 6 7 8 9 10 11 12];
y=[0.92 0.87 0.79 0.71 0.90 0.83 0.71 0.8 0.99 0.89 0.88 0.78];
plot(x,y);
set(gca,'ylim',[0 max(y)]);
set(gca,'ytick',[0 0.3 0.6 0.9])

Wayne

Tags for 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