Thread Subject: plots with for loops..URGENT PLZ

Subject: plots with for loops..URGENT PLZ

From: Abinayan Parthiban

Date: 16 Nov, 2007 15:07:27

Message: 1 of 4

hi,
Im starting to learn matlab,and I have a problem.
Basically, I have 2 column matrices,
X=[1;2;3;4;5;6;7],Y=[1;3;5;6;8;7;9]..
I want to plot them for each coordinates, but I want them
to plot each coordinate in the graph after a 2 second
interval. So, the plot looks something like this,

      | |
      | ---> after 2 seconds--> | .(1,3)
      | .(1,1) |
      |_______ |_______

And so, on.. It should be on the same plot, so that it
looks like an animation.
I was trying to use the basic plot(x,y) with a for loop,
and trying to find some kind of a delay function, so that
it delays the plot by 2 secs. Can anyone please help me on
this programme. Thanks.
Abi.

Subject: plots with for loops..URGENT PLZ

From: Stuart Kozola

Date: 16 Nov, 2007 15:15:21

Message: 2 of 4

Try:

help pause

'pause(2)' will pause for two seconds. You should also look at 'drawnow' if
your plot does not refresh as fast as you'd hoped.

Stu


"Abinayan Parthiban" <abinayanp@yahoo.co.uk> wrote in message
news:fhkbnf$56v$1@fred.mathworks.com...
> hi,
> Im starting to learn matlab,and I have a problem.
> Basically, I have 2 column matrices,
> X=[1;2;3;4;5;6;7],Y=[1;3;5;6;8;7;9]..
> I want to plot them for each coordinates, but I want them
> to plot each coordinate in the graph after a 2 second
> interval. So, the plot looks something like this,
>
> | |
> | ---> after 2 seconds--> | .(1,3)
> | .(1,1) |
> |_______ |_______
>
> And so, on.. It should be on the same plot, so that it
> looks like an animation.
> I was trying to use the basic plot(x,y) with a for loop,
> and trying to find some kind of a delay function, so that
> it delays the plot by 2 secs. Can anyone please help me on
> this programme. Thanks.
> Abi.


Subject: plots with for loops..URGENT PLZ

From: Abinayan Parthiban

Date: 16 Nov, 2007 15:35:47

Message: 3 of 4

oh.. will look for it in the help.. thanks very much for
that..
Now if I wanted to plot each coordinates one at a time, how
do i use the for loop for that?
X=[1;2;3;4;5;6;7],Y=[1;3;5;6;8;7;9]
 those are the coordinates.
Thanks.

Abi.








"Stuart Kozola" <skozola@mathworks.com> wrote in message
<fhkc6a$brv$1@fred.mathworks.com>...
> Try:
>
> help pause
>
> 'pause(2)' will pause for two seconds. You should also
look at 'drawnow' if
> your plot does not refresh as fast as you'd hoped.
>
> Stu
>
>
> "Abinayan Parthiban" <abinayanp@yahoo.co.uk> wrote in
message
> news:fhkbnf$56v$1@fred.mathworks.com...
> > hi,
> > Im starting to learn matlab,and I have a problem.
> > Basically, I have 2 column matrices,
> > X=[1;2;3;4;5;6;7],Y=[1;3;5;6;8;7;9]..
> > I want to plot them for each coordinates, but I want
them
> > to plot each coordinate in the graph after a 2 second
> > interval. So, the plot looks something like this,
> >
> > | |
> > | ---> after 2 seconds--> | .(1,3)
> > | .(1,1) |
> > |_______ |_______
> >
> > And so, on.. It should be on the same plot, so that it
> > looks like an animation.
> > I was trying to use the basic plot(x,y) with a for loop,
> > and trying to find some kind of a delay function, so
that
> > it delays the plot by 2 secs. Can anyone please help me
on
> > this programme. Thanks.
> > Abi.
>
>

Subject: plots with for loops..URGENT PLZ

From: Peter Boettcher

Date: 16 Nov, 2007 15:37:33

Message: 4 of 4

"Abinayan Parthiban" <abinayanp@yahoo.co.uk> writes:

> oh.. will look for it in the help.. thanks very much for
> that..
> Now if I wanted to plot each coordinates one at a time, how
> do i use the for loop for that?
> X=[1;2;3;4;5;6;7],Y=[1;3;5;6;8;7;9]
> those are the coordinates.
> Thanks.

How do you plot just the first point? How do you plot just the second
point? Do those at the command line.

Then, how do you generalize that to plot the i'th point. Try it out.

Then, wrap that line in a loop that sets i to changing values.

-Peter

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
animation Abinayan Parthiban 16 Nov, 2007 10:40:02
plots Abinayan Parthiban 16 Nov, 2007 10:40:02
2d animation Abinayan Parthiban 16 Nov, 2007 10:10:25
2dplots Abinayan Parthiban 16 Nov, 2007 10:10:25
plot Abinayan Parthiban 16 Nov, 2007 10:10:25
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com