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

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

    y = zeros(1000);
    for i=1:100
    y(i) = 1;
    for i=101:500
    y(i) = 2;
    for i=501:1000
    y(i) = -5;
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook