How to Represent Discrete Time Signals in Matlab

In summary, the conversation discusses how to represent signals in discrete time using Matlab. The problem at hand involves plotting the result of the convolution of two signals, r[n] and u[n]. The conversation also touches on the difference between discrete-time and continuous-time signals and suggests using the "conv" function in Matlab to calculate the convolution.
  • #1
EugP
107
0
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:
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.
 
Physics news on Phys.org
  • #2
How are r[n] and u[n] defined?
 
  • #3
antonantal said:
How are r[n] and u[n] defined?

Well for this particular problem it doesn't say, but for a previous problem in continuous time, they are defined as:

Code:
% 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.
 
  • #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.
 

What is a discrete time signal?

A discrete time signal is a type of signal that is represented by a sequence of numbers, with each number representing the amplitude of the signal at a specific time interval. Unlike continuous time signals, which have an infinite number of values, discrete time signals have a finite number of values and are only defined at specific time intervals.

How can I represent a discrete time signal in Matlab?

To represent a discrete time signal in Matlab, you can use either a vector or a matrix. A vector can be used for one-dimensional signals, while a matrix can be used for multi-dimensional signals. Each element in the vector or matrix represents the amplitude of the signal at a specific time interval.

What is the difference between a continuous time signal and a discrete time signal?

A continuous time signal is a type of signal that is defined at every point in time, while a discrete time signal is only defined at specific time intervals. Continuous time signals have an infinite number of values, while discrete time signals have a finite number of values. Additionally, continuous time signals can take on any value, while discrete time signals can only take on values that are represented by the numbers in the sequence.

How can I plot a discrete time signal in Matlab?

To plot a discrete time signal in Matlab, you can use the plot function. This function takes in the sequence of numbers representing the signal as its input, and plots the values on a graph with the x-axis representing the time intervals and the y-axis representing the amplitude of the signal.

Can I manipulate a discrete time signal in Matlab?

Yes, you can manipulate a discrete time signal in Matlab using various functions such as fft, conv, and filter. These functions allow you to perform operations such as filtering, convolution, and frequency analysis on the discrete time signal.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
829
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
745
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
Back
Top