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:
Continuous Plotting

Subject: Continuous Plotting

From: matlab_matlab@hotmail.com (Matlab Desperado)

Date: 27 Feb, 2001 01:06:27

Message: 1 of 3

Hi,

If I have a code like this:

for i=1:1000
y(i,1)=i*2;
end;
plot(y);

The vector y will be plotted at the end. But now I want every point of
y to be plotted when it is calculated and appended to the previous
plots. It will look like some real time system. How should I do it?

Thanks a lot in advance.

Regards,
Matlab Desperado @>-

Subject: Continuous Plotting

From: John Williams

Date: 27 Feb, 2001 16:48:48

Message: 2 of 3

Matlab Desperado wrote:
>
> Hi,
>
> If I have a code like this:
>
> for i=1:1000
> y(i,1)=i*2;
> end;
> plot(y);
>
> The vector y will be plotted at the end. But now I want every point of
> y to be plotted when it is calculated and appended to the previous
> plots. It will look like some real time system. How should I do it?
>

>> help comet

 COMET Comet-like trajectory.
    COMET(Y) displays an animated comet plot of the vector Y.
    COMET(X,Y) displays an animated comet plot of vector Y vs. X.
    COMET(X,Y,p) uses a comet of length p*length(Y). Default is p =
0.10.
 
    Example:
        t = -pi:pi/200:pi;
        comet(t,tan(sin(t))-sin(tan(t)))
 
    See also COMET3.



Regards,

John

Subject: Continuous Plotting

From: G. Anthony Reina

Date: 5 Mar, 2001 16:20:38

Message: 3 of 3

Matlab Desperado wrote:

> Hi,
>
> If I have a code like this:
>
> for i=1:1000
> y(i,1)=i*2;
> end;
> plot(y);
>
> The vector y will be plotted at the end. But now I want every point of
> y to be plotted when it is calculated and appended to the previous
> plots. It will look like some real time system. How should I do it?
>
> Thanks a lot in advance.
>
> Regards,
> Matlab Desperado @>-

hold on;
for i=1:1000
y(i,1)=i*2;
ploy(i, y(i));
end;
hold off;


The 'hold' function will allow you to append the graph.

-Tony

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