How to plot this discrete signal?

24 vues (au cours des 30 derniers jours)
Jay
Jay le 20 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.

Réponse acceptée

Kiran Felix Robert
Kiran Felix Robert le 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)

Plus de réponses (0)

Catégories

En savoir plus sur Signal Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by