![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/559192/image.png)
How to plot this discrete signal?
21 ビュー (過去 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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/556347/image.png)
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 件のコメント
採用された回答
Kiran Felix Robert
2021 年 3 月 23 日
Hi Jay,
I assume that the following is the equation you are trying to implement and plot,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/559192/image.png)
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Signal Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!