顺便把我第一个实验的程序分享了,多指教啊
一.
n1=-20:20;
x1=[zeros(1,20),1,zeros(1,20)];
x2=[zeros(1,20),ones(1,21)];
n2=-25:15;
y1=x1;
n3=-12:28;
y2=x2;
subplot(2,2,1);stem(n1,x1);xlabel('n');ylabel('x1');axis([-30,30,-0.5,1.5]);grid;
subplot(2,2,2);stem(n1,x2);xlabel('n');ylabel('x2');axis([-30,30,-0.5,1.5]);grid;
subplot(2,2,3);stem(n2,y1);xlabel('n');ylabel('y1');axis([-30,30,-0.5,1.5]);grid;
subplot(2,2,4);stem(n3,y2);xlabel('n');ylabel('y2');axis([-30,30,-0.5,1.5]);grid;
二.
n=0:100;
x3=sin(pi*n/16);
x4=sin(n/2);
x5=cos(pi*n/12)+cos(3*pi*n/8);
subplot(2,2,1);stem(n,x3);xlabel('n');ylabel('x3');axis([-10,110,-2,2]);grid;
subplot(2,2,2);stem(n,x4);xlabel('n');ylabel('x4');axis([-10,110,-2,2]);grid;
subplot(2,2,3);stem(n,x5);xlabel('n');ylabel('x5');axis([-10,110,-2,2]);grid;
三.
clear all;
n=0:30;
x6=0.2*(0.8.^n);
x7=exp((-1/12+(i*pi/6)).*n);
figure(1);stem(n,x6);xlabel('n');ylabel('x6');grid;
figure(2);subplot(1,2,1);plot(n,abs(x7));xlabel('n');ylabel('abs(x7)');grid;
subplot(1,2,2);plot(n,angle(x7));xlabel('n');ylabel('angle(x7)');grid;