?? example2_10.m
字號:
%==========================================================================
% Name:example2_10.m
%==========================================================================
clear;close all;
n0=20;
n1=20;
n=-n0:n1;
x1=((0.5).^n).*u(n);
x2=((2).^n).*u(-n);
x=x1+x2;
h=u(n);
y1=conv(x1,h);
y2=conv(x2,h);
y=conv(x,h);
%將卷積的結果取得和兩個輸入的信號一樣長,
%以便在相同的坐標中繪制其圖形并方便比較。
y1=y1([n0+1:2*n0+n1+1]);
y2=y2([n0+1:2*n0+n1+1]);
y=y([n0+1:2*n0+n1+1]);
%
figure(1)
subplot(3,2,1)
stem(n,x1,'.');axis([-n0+10,n1-10,1.1*min(x1),1.2*max(x1)]);grid on
subplot(3,2,2)
stem(n,x2,'.');axis([-n0+10,n1-10,1.1*min(x2),1.2*max(x2)]);grid on
subplot(3,2,3);
stem(n,h,'r.');axis([-n0+10,n1-10,1.1*min(h),1.2*max(h)]);grid on
subplot(3,2,4);
stem(n,h,'r.');axis([-n0+10,n1-10,1.1*min(h),1.2*max(h)]);grid on
subplot(3,2,5);
stem(n,y1,'r.');axis([-n0+10,n1-10,1.1*min(y1),1.2*max(y1)]);grid on
subplot(3,2,6);
stem(n,y2,'r.');axis([-n0+10,n1-10,1.1*min(y2),1.2*max(y2)]);grid on
figure(2)
subplot(3,2,3);
stem(n,y1,'r.');axis([-n0+10,n1-10,1.1*min(y1),1.2*max(y1)]);grid on
subplot(3,2,4);
stem(n,y2,'r.');axis([-n0+10,n1-10,1.1*min(y2),1.2*max(y2)]);grid on
subplot(3,1,1);
stem(n,x,'r.');axis([-n0,n1,1.1*min(x),1.2*max(x)]);grid on
subplot(3,1,3);
stem(n,y,'r.');axis([-n0+10,n1-10,1.1*min(y),1.2*max(y)]);grid on
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -