Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A simple plot animation in Matlab

  1. Feb 14, 2006 #1
    Can anyone plesae help me plot [itex]y(x,t)=\sin(x)\cdot e^{-t}[/itex] on an XY axes system, and have the graph to propagate in time?

    I'm really new to Matlab, and the animation demos I found were too fancy, and I couldn't figure out how to do what I want.

    Thanks in advance.
  2. jcsd
  3. Feb 14, 2006 #2
    something like plot(sin(x)*e^(-t),([x, xstart, xend],[t, tstart, tend]))
  4. Feb 14, 2006 #3
    I think that plot will just draw the implicit function [itex]f(x,t)=0[/itex].
    As I said I'm really new, I tried to type what you said and it gave a bunch of error messages. I tried to create vectors x and t, when it didn't work I tried symbolic variables x and t, replace e with exp(), remove some brackets... still couldn't do it.
  5. Feb 14, 2006 #4
    Ok try again
    plot3d(y+sin(x)*e^(-t),([y, ystart, yend],[x, xstart, xend],[t, tstart, tend]));
    Last edited: Feb 14, 2006
  6. Feb 14, 2006 #5
    Are you sure about that?
    First I didn't see any "plot3d"... there's just the "plot3" and "surf" - The only reference I saw between plot3 and animation is that it can draw a curve from parameterization, and animate a ball traveling on the curve (taking the parameter as time) - this is NOT what I need.
    As I said, I would like to see a sine wave [itex]y=\sin(x)[/itex] whose amplitude decreases exponentially ON TIME when I push a "Play" button or something.
    Last edited: Feb 14, 2006
  7. Feb 14, 2006 #6
    YES! I think I've done it!
    But it's awfully ugly :yuck: does anybody know a better way to do it?

    Code (Text):

    function doit
    axis([-2*pi 2*pi -1 1])
    axis square
    grid off
    for t=2:.1:7
    I constructed it from a demo.
  8. Jul 8, 2008 #7
    Hi guys

    I have a similar doubt, I have an animation plot with vectors.

    I have the following vector A, for example, A at time zero = [23 25 32 21 43], A in the time 1 = [32 22 33 12 42], and so on, several vectors changing their values over time.

    It is possible to animate the plot in matlab?

    Someone could help?

    Thanks a lot guys..
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: A simple plot animation in Matlab
  1. MATLAB plots (Replies: 1)

  2. Matlab Plot (Replies: 2)

  3. Plotting in MATLAB (Replies: 8)

  4. Plotting with MATLAB (Replies: 1)