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

Discrete Time in Matlab

  1. Sep 20, 2007 #1
    Can anyone tell me how to represent signals in discrete time in Matlab?
    I had a lab assignment in my Linear Systems and Signals class, which said to plot the result of this:

    [tex]r[-k - 2] \ast u[k -2][/tex], where [tex]\ast[/tex] represents convolution.

    Now, I know the answer, which is 0. I now need to plot it. The way I plotted it, is I did the following:

    Code (Text):

    x = (0:100);
    y = 0;
    plot (x, y);
    Of course I get a line on x = 0 which has all values of y as 0, but that's the TRULY right way. I want Matlab to get that answer by itself.

    I tried reading some stuff online about discrete time in Matlab, but nothing seems to help. Maybe it's because this is the first time I've ever used Matlab.

    If someone could please help me, it would be greatly appreciated.
     
  2. jcsd
  3. Sep 20, 2007 #2
    How are r[n] and u[n] defined?
     
  4. Sep 20, 2007 #3
    Well for this particular problem it doesn't say, but for a previous problem in continuous time, they are defined as:

    Code (Text):

    % continuous-time unit step
    t1=-10:0; t2=0:10; t=[t1 t2];
    u=[zeros(1,11) ones(1,11)];

    % continuous-time ramp signal
    t1=-10:-1; t2=0:10; t=[t1 t2]
    r=[zeros(1,10) t2]
     
    So I will assume it should remain that way.
     
  5. Sep 20, 2007 #4
    I don't understand how do you make the difference between discrete-time and continuous-time.

    Anyway, those signals are discrete-time since they are composed of the samples at the moments in the vector t.

    You should use the function "conv" to calculate the convolution of the two signals.
    Type "help conv" in Matlab for more info on the "conv" function.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Discrete Time in Matlab
  1. Time Sync MATLAB (Replies: 1)

Loading...