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

Help Plotting a Signal Waveform

  1. Oct 12, 2012 #1
    My mat lab skills are pretty low, basically i want to know how to make a waveform using 1000 points of data.

    if the data is for example

    y = 1 for 0<n<0.1
    y = 2 for 0.1<n<0.5
    y = -5 for 0.5 < n < 1

    so how could i plot this waveform using 1000 points of data

    cheers
     
  2. jcsd
  3. Oct 14, 2012 #2
    Try this and see what happens

    y = zeros(1000);
    for i=1:100
    y(i) = 1;
    end;
    for i=101:500
    y(i) = 2;
    end;
    for i=501:1000
    y(i) = -5;
    end;
    plot(y)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Help Plotting a Signal Waveform
  1. Help with MatLab plot (Replies: 0)

  2. MATLAB: Plotting help (Replies: 2)

Loading...