フィルターのクリア

how to inverse signal in matlab ?

17 ビュー (過去 30 日間)
tomer polsky
tomer polsky 2018 年 6 月 26 日
コメント済み: tomer polsky 2018 年 6 月 26 日
hello in my exmaple i have this 2 signals : x=[3 11 7 0 -1 4 2] n1=-3:1:3 h=[ 2 3 0 -5 2 1] n2=-1:1:4
and i need to plot this plots : x(k)&h(k),x(k)&h(-k),x(k)&h(-1-k),x(k)&h(2-k) hoe ever so far i did only the first one :
x=[3 11 7 0 -1 4 2]
n1=-3:1:3
h=[ 2 3 0 -5 2 1]
n2=-1:1:4
subplot(2,2,1)
stem(n1,x)
hold on
stem(n2,h,':')
title('x(k) & h(k)');
xlim([-5 5])
xlabel('k')
legend('solid-x','dashed-h');
subplot(2,2,2)
stem(n1,x)
hold on
stem(n2,flip(h),':')
title('x(k) & h(-k)');
xlim([-5 5])
xlabel('k')
legend('solid-x','dashed-h');
how ever the my second plot is wrong . how to inverse my h(k) ? and moving it by 2 ? should run a for loop that will move my signal ?

回答 (1 件)

Ankita Bansal
Ankita Bansal 2018 年 6 月 26 日
Hi, for h(-k) you need to change the sign of n2 and you need to flip it also.
Change " stem(n2,flip(h),':') " to:
% for h(-k)
stem(flip(-n2),flip(h),':')
% for h(-1-k)
stem(-1+flip(-n2),flip(h),':')
% for h(2-k)
stem(2+flip(-n2),flip(h),':')
  1 件のコメント
tomer polsky
tomer polsky 2018 年 6 月 26 日
ohh i forgot to flip the n2 ... thank you very much my friend .

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

カテゴリ

Help Center および File ExchangeSimulation, Tuning, and Visualization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by