内蒙古科技大学信号与系统实验2,3资料
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实验2作业
-1
01234
-101
2
Signal y1(t)
-1
01234
-10
1
2
Signal y2(t)
-2
-1
1
2
345
6
7
8
0123
4The convolition of y1(t) and y2(t)
Time t sec
clear;close all;
t0=-2;t1=4;dt=0.01; t=t0:dt:t1; u0=(t>=0); u1=((t-1)>=0); u2=((t-2)>=0); u3=((t-3)>=0); x=u0-u2; h=u1-u3;
y=dt*conv(x,h); subplot(221)
plot(t,x),grid on,title('Signal x(t)'),axis([t0,t1,-0.2,1.2]) subplot(222)
plot(t,h),grid on,title('Signal h(t)'),axis([t0,t1,-0.2,1.2]) subplot(212) t=2*t0:dt:2*t1;
plot(t,y),grid on,title('The convolution of x(t) and h(t)'), axis([2*t0,2*t1,-0.1,3]), xlabel('Time t sec')
实验2例题
-2
2
4
00.5
1
Signal x(t)
-2
2
4
00.5
1
Signal h(t)
-4
-2
24
6
8
00.2
0.4The convolution of x(t) and h(t)
Time t sec
clear ;close all ; t0=-2;t1=4;dt=0.01; t=t0:dt:t1; x=u(t)-u(t-1); h=t.*(u(t)-u(t-1)); y=dt*conv(x,h); subplot(221)
plot(t,x),grid on ,title('Signal x(t)'),axis([t0,t1,-0.2,1.2]) subplot(222)
plot(t,h),grid on ,title('Signal h(t)'),axis([t0,t1,-0.2,1.2]) subplot(212) t=2*t0:dt:2*t1;
plot(t,y),grid on ,title('The convolution of x(t) and h(t)'),axis([2*t0,2*t1,-0.1,0.6]), xlabel('Time t sec')
实验3:
系统1带通滤波器
05
10
0.5
1
Magnitude response
5
10
-2-101
2Phase response
Frequency in rad/sec
510
0.5
1
Real part of frequency response
Frequency in rad/sec
5
10
-0.5
0.5
Imaginary part of frequency response Frequency in rad/sec
%program3_1 b=[1 0]; a=[1 1 25];
[H,w]=freqs(b,a); Hm=abs(H); phai=angle(H); Hr=real(H); Hi=imag(H); subplot(221)
plot(w,Hm),grid on ,title('Magnitude response'), subplot(223)
plot(w,phai),grid on ,title('Phase response'), xlabel('Frequency in rad/sec') subplot(222)
plot(w,Hr),grid on ,title('Real part of frequency response'), xlabel('Frequency in rad/sec') subplot(224)
plot(w,Hi),grid on ,title('Imaginary part of frequency response'),
xlabel('Frequency in rad/sec')
系统2 全通滤波器
05
10
1
1
1
1
Magnitude response
5
10
0123
4Phase response
Frequency in rad/sec
510
-1
-0.50
0.5
1Real part of frequency response
Frequency in rad/sec
5
10
0.5
1
Imaginary part of frequency response Frequency in rad/sec
%program3_1 b=[1 -1]; a=[1 1];
[H,w]=freqs(b,a); Hm=abs(H); phai=angle(H); Hr=real(H); Hi=imag(H); subplot(221)
plot(w,Hm),grid on ,title('Magnitude response'), subplot(223)
plot(w,phai),grid on ,title('Phase response'), xlabel('Frequency in rad/sec') subplot(222)
plot(w,Hr),grid on ,title('Real part of frequency response'), xlabel('Frequency in rad/sec') subplot(224)
plot(w,Hi),grid on ,title('Imaginary part of frequency response'), xlabel('Frequency in rad/sec')
系统3 低通滤波器
05
10
0.5
1
Magnitude response
5
10
-4-202
4Phase response
Frequency in rad/sec
510
-1
-0.5
00.5
1Real part of frequency response
Frequency in rad/sec
5
10
-1-0.500.5
1
Imaginary part of frequency response Frequency in rad/sec
%program3_1 b=[262];
a=[1 10 48 148 306 401 262]; [H,w]=freqs(b,a); Hm=abs(H); phai=angle(H); Hr=real(H); Hi=imag(H); subplot(221)
plot(w,Hm),grid on ,title('Magnitude response'), subplot(223)
plot(w,phai),grid on ,title('Phase response'), xlabel('Frequency in rad/sec') subplot(222)
plot(w,Hr),grid on ,title('Real part of frequency response'), xlabel('Frequency in rad/sec') subplot(224)
plot(w,Hi),grid on ,title('Imaginary part of frequency response'), xlabel('Frequency in rad/sec')
05
10
0.20.40.6
0.8Magnitude response
5
10
-3
-2
-1
0Phase response
Frequency in rad/sec
510
-0.2
00.20.4
0.6Real part of frequency response
Frequency in rad/sec
5
10
-0.4
-0.3
-0.2
-0.1
Imaginary part of frequency response Frequency in rad/sec
%program3_1 b=[1]; a=[1 3 2];
[H,w]=freqs(b,a); Hm=abs(H); phai=angle(H); Hr=real(H); Hi=imag(H); subplot(221)
plot(w,Hm),grid on ,title('Magnitude response'), subplot(223)
plot(w,phai),grid on ,title('Phase response'), xlabel('Frequency in rad/sec') subplot(222)
plot(w,Hr),grid on ,title('Real part of frequency response'), xlabel('Frequency in rad/sec') subplot(224)
plot(w,Hi),grid on ,title('Imaginary part of frequency response'), xlabel('Frequency in rad/sec')
第一题:
1: 稳定系统
num=[1,0];
den=[1,32,60];
p=roots(den);
z=roots(num);
plot(real(p),imag(p),'*');hold on; plot(real(z),imag(z),'o');grid on 2 : 不稳定系统
num=[1,0]; den=[1,-1,-6]; p=roots(den); z=roots(num);
plot(real(p),imag(p),'*');hold on ; plot(real(z),imag(z),'o');grid on
第二题:
-0.2
0.2
0.4
0.6
0.8
1
1.2
脉冲响应
num=[1,0]; den=[1,32,60]; T=0:0.1:3;
y1=impulse(num,den,T); y2=step(num,den,T); U=sin(T);
y3=lsim(num,den,U,T);
subplot(1,1,1);plot(T,y1);title('Âö³åÏìÓ¦');grid on ;
0.5
1
1.5
2
2.5
3
050010001500200025003000350040004500
5000脉冲响应
num=[1,0]; den=[1,-1,-6]; T=0:0.1:3;
y1=impulse(num,den,T); y2=step(num,den,T); U=sin(T);
y3=lsim(num,den,U,T);
subplot(1,1,1);plot(T,y1);title('Âö³åÏìÓ¦');grid on ;
第三题:
幅频特性
相频特性
num=[1
,0];
den=[1,32,60]; W=0:0.1:100; h=freqs(num,den,W);
subplot(2,1,1);plot(W,abs(h));title('·ùƵÌØÐÔ');grid on ;
subplot(2,1,2);plot(W,angle(h));title('ÏàƵÌØÐÔ');grid on ;
例题: 1:
1
2
3
00.20.4
0.60.81脉冲响应
1
2
3
0.5
11.5
阶跃响应
0123
0.5
1
1.5输入为u=sint 的响应
2:
01020
0.7071
1.25
幅频特性
01020
-1.5708
-0.7854
相频特性
3:
010200
0.7071
1.25
幅频特性
-4
-202
-0.8-0.6
-0.4-0.200.20.40.6
0.8
实验5: 1:
A continuous-time signal x(t)
Time t
The sampled v ersion x[n] of x(t)
Time index n
0.1
0.2
0.3
0.4
Magnitude spectrum of x(t) 0
0.1
0.2
0.3
0.4
Magnitude spectrum of x[n]
Frequency in radians/s
clear,close all,
tmax=4;dt=0.01;
t=0:dt:tmax;
Ts=1/10;
ws=2*pi/Ts;
w0=20*pi;dw=0.1;
w=-w0:dw:w0;
n=0:1:tmax/Ts;
x=exp(-4*t).*(t>=0);
xn=exp(-4*n*Ts);
subplot(2,2,1);plot(t,x);title('A continuous-time signal x(t)');
xlabel('Time t');axis([0,tmax,0,1]);grid on;
subplot(2,2,3);stem(n,xn,'.');title('The sampled version x[n] of x(t)'); xlabel('Time index n');axis([0,tmax/Ts,0,1]);grid on;
Xa=x*exp(-j*t'*w)*dt;
X=0;
for k=-8:8;
X=X+x*exp(-j*t'*(w-k*ws))*dt;
end
subplot(2,2,2);plot(w,abs(Xa));title('Magnitude spectrum of
x(t)');grid on;
axis([-60,60,0,1.8*max(abs(Xa))]);
subplot(2,2,4); plot(w,abs(X)); title('Magnitude spectrum of x[n]'); xlabel('Frequency in radians/s');grid on;
axis([-60,60,0,1.8*max(abs(Xa))]);
2:
510
-1-0.500.5
1 A continuous-time signal x(t)Time t
The sampled version x[n] of x(t)
Time index n
clear,close all , t=0:0.01:10; Ts=1/4; n=0:Ts:10; x=cos(0.5*pi*t); xn=cos(0.5*pi*n); subplot(2,2,1);
plot(t,x);title('A continuous-time signal x(t)');xlabel('Time t'); subplot(2,2,2);
stem(n,xn,'.');title('The sampled version x[n] of x(t)');xlabel('Time index n');
3:
1:was/wm=:4
-2
-1
012
01
2Time t
00.511.52
Time index n
-2
-1
01
2
012Time t
Reconstructed signal xr(t)
-2
-1
01
2
00.010.020.030.04
Error
Time t
-2
-1.5-1-0.5
00.51 1.52
Time index n
2:was/wm=:10
-2
-1
01
2
01
2Time t
Reconstructed signal xr(t)
-2
-1
01
2
00.010.020.03
0.04
Error
Time t
-2
-1
012
01
2Time t
Time index n
-2
-1.5-1-0.5
00.51 1.52
Time index n。