1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Unit Step Function and Matlab

  1. Feb 18, 2009 #1
    1. The problem statement, all variables and given/known data

    plot this function:
    cos(pi*n)*u(n)



    3. The attempt at a solution

    n=0:1:10;
    y=(n>=0);

    x(n) = cos(pi()*n)*y

    figure(1)
    plot(y)
     
  2. jcsd
  3. Feb 19, 2009 #2
    y(t>=0)=1; ?

    This should work ..
    t=-2:0.1:2;
    x=cos(pi()*t); x(t<=0)=0;
    plot(t,x);
     
    Last edited: Feb 19, 2009
  4. Feb 19, 2009 #3
    I don´t get what x(t<=0)=0 does ?
    And where do you multiply the unit step function?
    You wrote x=cos(pi()*t); but I can´t see where u(t) is...
     
  5. Feb 19, 2009 #4
    nevermind I got it. thanks
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Unit Step Function and Matlab
Loading...