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:
plot

Subject: plot

From: Mahi N

Date: 22 Sep, 2009 18:15:23

Message: 1 of 3

please help me to correct and plot the code

y = [200501 266742 288837];
x = [1 2 3];
plot(x,y)

linspace(1,3,100)

This does not work.i need 100 points between 1 and 3 which should be the x-axis.

thanks

Subject: plot

From: Dave Brackett

Date: 22 Sep, 2009 23:00:20

Message: 2 of 3

"Mahi N" <nakshatra_v@yahoo.com> wrote in message <h9b47r$dmq$1@fred.mathworks.com>...
> please help me to correct and plot the code
>
> y = [200501 266742 288837];
> x = [1 2 3];
> plot(x,y)
>
> linspace(1,3,100)
>
> This does not work.i need 100 points between 1 and 3 which should be the x-axis.
>
> thanks

linspace gives you exactly what you have asked for, 100 points between 1 and 3.

Subject: plot

From: arich82

Date: 22 Sep, 2009 23:56:03

Message: 3 of 3

"Mahi N" <nakshatra_v@yahoo.com> wrote in message <h9b47r$dmq$1@fred.mathworks.com>...
> please help me to correct and plot the code
>
> y = [200501 266742 288837];
> x = [1 2 3];
> plot(x,y)
>
> linspace(1,3,100)
>
> This does not work.i need 100 points between 1 and 3 which should be the x-axis.
>
> thanks

If you want 'x = linspace(1, 3, 100);', you need to find 297 more data points for your y vector to plot against it. Perhaps

>> doc interp1
>> doc spline

might help?

--

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