plot summation of shifted discrete signals
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ayman daraghmah
am 16 Sep. 2015
Kommentiert: Nguyen Hong Son
am 17 Apr. 2020
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);
0 Kommentare
Akzeptierte Antwort
Hamoon
am 17 Sep. 2015
Bearbeitet: Hamoon
am 17 Sep. 2015
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 Kommentare
Hamoon
am 17 Sep. 2015
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
am 17 Apr. 2020
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!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!