How to plot this discrete signal?

25 次查看(过去 30 天)
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.

采纳的回答

Kiran Felix Robert
Kiran Felix Robert 2021-3-23
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 个)

类别

Help CenterFile Exchange 中查找有关 Signal Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by