?? dconvo.m
字號:
% The program of compute f=x*h
% f: 卷積和序列f(k)對應的非零樣值向量
% n: 序列f(n)的對應序號向量
% x: 序列x(n)的樣值向量
% h: 序列h(n)的樣值向量
n=input('Type the index range:');
x=input('Type the input sequency x[n]:');
h=input('Type the impulse response sequency h[n]:');
y=conv(x,h); %計算序列x與h的卷積和f
k0=2*n(1); %計算序列f樣值的起點位置
k3=length(x)+length(h)-2; %計算卷積和f的樣值的寬度
k=k0:k0+k3; %確定卷積和f樣值的序號向量
subplot(2,2,1)
stem(n,x,'.') %在子圖1繪序列x(n)時域波形圖
title('x(n)')
xlabel('n')
ylabel('x(n)')
subplot(2,2,2)
stem(n,h,'.') %在圖2繪序列h(n)時波形圖
title('h(n)')
xlabel('n')
ylabel('h(n)')
subplot(2,2,3)
stem(k,y,'.'); %在子圖3繪序列f(n)的波形圖
title('The convolution y(n) of x(n) and h(n)')
xlabel('n')
ylabel('y(n)')
m=get(gca,'position');
m(3)=2.5*m(3);
set(gca,'position',m) %將第三個子圖的橫坐標范圍擴為原來的2.5倍
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -