フィルターのクリア

plot summation of shifted discrete signals

2 ビュー (過去 30 日間)
ayman daraghmah
ayman daraghmah 2015 年 9 月 16 日
コメント済み: Nguyen Hong Son 2020 年 4 月 17 日
n=-4:2;
y=[1,-2,4,6,-5,8,10];
n=n-2
stem(n,y);
I want to plot Z = y(n-2)+y(n+1);

採用された回答

Hamoon
Hamoon 2015 年 9 月 17 日
編集済み: Hamoon 2015 年 9 月 17 日
n=-4:2;
y=[1,-2,4,6,-5,8,10];
maxShift = 10; % maximum shift that you may want,
% you can't shift more than this value,
% you should set this value high enough
% I could set it to be 2 here, but I prefer 10
n=min(n)-maxShift:1:max(n)+maxShift; % define proper range for n
y=[zeros(1,maxShift), y, zeros(1,maxShift)]; % add zeros to the begining and
% end of y
z= circshift(y',-2) + circshift(y',1); % calculate your new signal. you need
% transpose of y ==> y'
  2 件のコメント
Hamoon
Hamoon 2015 年 9 月 17 日
here is the output using:
subplot(2,1,1)
stem(n,y);
title('y')
axis([-15 15 -10 20])
subplot(2,1,2)
stem(n,z);
title('z')
axis([-15 15 -10 20])
Nguyen Hong Son
Nguyen Hong Son 2020 年 4 月 17 日
Excuse me. Can I ask you why we can use circular shift to compute operations of shifted discrete signals? (I can't have the intuition or visualization of it)
Why do we need the transpose of y in the last line of code?
Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by