Azzera filtri
Azzera filtri

Animated Discrete Stem Plot

1 visualizzazione (ultimi 30 giorni)
Amritpal Kaur
Amritpal Kaur il 10 Nov 2016
So I want to create an animated plot of a discrete-time complex exponential function. The simplest non-animated plot would be given by this:
n=-5:40;
x=(exp((3*4j)*n)).*(n>=0);
y=real(x);
subplot(2,1,1);
stem (n,y)
z=imag(x);
subplot(2,1,2);
stem (n,z)
How do I animate it to show the function for the different numbers of samples considered in a given interval (assuming I have a time interval specified by start second and end second and a vector containing the number of sample values in the given interval)?
I tried along these lines:
figure,hold on
xlim([min(x(:)) max(x(:))])
ylim([min(y(:)) max(y(:))])
%// Plot point by point
for k = 1:numel(x)
stem (k,y) %// Choose your own marker here
pause(0.001);
end
That doesn't compile. How to achieve this? Thanks.

Risposte (0)

Categorie

Scopri di più su Animation in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by