can anyone help me to make such a signal s(-t-5) from signal s? I have tried the following code: fliplr([zeros(1,5) s]) Is it right?

 채택된 답변

Abhiram Bhanuprakash
Abhiram Bhanuprakash 2015년 5월 20일

0 개 추천

Hi sH,
I think your approach is right, and it accounts for the Y axis values.
But, for the X axis indices, I think you should do something like this:
Say you have a signal s(n) = [1 2 3 4], and you wish to obtain s1(n) = s(-n-5):
s = [1 2 3 4];
inds = 0:length(s)-1;
figure, plot(inds,s); %considering time index 0 as the origin
s1 = fliplr([zeros(1,5) a]);
flippedInds = -(length(s1)-1):0;
figure, plot(flippedInds,s1);
For discrete signal plots, you can use the stem function instead of plot.
Hope this helps,
Cheers!
Abhiram.

댓글 수: 3

Should the
s1 = fliplr([zeros(1,5) a]);
be
s1 = fliplr([zeros(1,5) s]);
?
Oops, sorry, my mistake.
It should be
s1 = fliplr([zeros(1,5) s]);
Thanks Walter for pointing it out.
sH
sH 2015년 5월 20일
thanks everyone

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

질문:

sH
2015년 5월 20일

댓글:

sH
2015년 5월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by