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!

Matlab code needed

  1. Aug 13, 2010 #1
    1. The problem statement, all variables and given/known data
    x(t)=4sin(0.5t).3u(t)
    x[n]=x(n2Ts)

    The 1st equation, x(t)=4sin(0.5t).2u(t)
    Code :
    >> A=2;
    >> wo=0.5;
    >> t=5:0.25:50;
    >> x=A*sin(wo*t).3*(t>=0);
    >> plot(t,x), grid on
    >> xlabel('t (s)'); ylabel('Amplitude(unit)')

    But the second one,x[n]=x(n2Ts), I don't know what code should I use to plot it out,pls help,thanks.
     
    Last edited: Aug 13, 2010
  2. jcsd
  3. Aug 13, 2010 #2
    Hi,
    The second part is just down sampling the x(t) by 2. You have already chosen Ts=0.25. So just leave a sample between every two samples and you will get x[n]
     
  4. Aug 13, 2010 #3
    Hi,
    U mean I just use below code to plot it out?
    >> T=0.25;
    >> x=2*T*(A*sin(wo*n).3*(n>=0));
     
    Last edited: Aug 13, 2010
  5. Aug 14, 2010 #4
    No one else can help?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab code needed
  1. Matlab code (Replies: 14)

Loading...