How to plot this discrete signal?
26 views (last 30 days)
Show older comments
Jay
on 20 Mar 2021
Answered: Kiran Felix Robert
on 23 Mar 2021
Given:
x(n) = {2, 4, -3, 1, -5, 4,7 }
n = [-4, -3, -2, -1, 0, 1, 2]
Plot the following using the stem function:
I am following Proaksis DSP using Matlab and I have the following thus far.
[x11, n11] = sigshift(xn, n, 1);
[x12, n12] = sigshift(xn, n, 2);
[x13, n13] = sigshift(xn, n, 3);
[x14, n14] = sigshift(xn, n, 4);
[x15, n15] = sigshift(xn, n, 5);
function [y,n] = sigshift(x, m, n0)
n = m + n0;
y = x;
end
Where I am just simply shifting the signal. I am having problems on scaling the signal by n which is a vector instead of a scalar.
0 Comments
Accepted Answer
Kiran Felix Robert
on 23 Mar 2021
Hi Jay,
I assume that the following is the equation you are trying to implement and plot,
The following code demonstrates this,
n = -4:2;
x = [2,4,-3,1,-5,4,7];
% padding zeros
X = [0,0,0,0,0,x];
y = zeros(1,length(n));
for i = 1:length(y)
y(i) = i*(X(i) + X(i+1) + X(i+2) + X(i+3) + X(i+4));
end
stem(n,y)
0 Comments
More Answers (0)
See Also
Categories
Find more on Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!