📄 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 + -