信号与线性系统分析
离散信号部分
1. 用MATLAB画出正弦离散序列的时域波形。
N=100;
n=-N:N;
w0=0.2;
f1=cos((pi*n*w0)/8);
f2=cos(2*n*w0);
subplot(211);
stem(n,f1); grid on;
title('f1=cos((pi*n*w0)/8)');
xlabel('n'); ylabel('f1(n)');
subplot(212);
stem(n,f2); grid on;
title('f2=cos(2*n)');
xlabel('n'); ylabel('f2(n)');
信号运算部分
2.已知信号
,画出
的波形;
t=-20:0.01:20;
f1=0.25*(t+1).*(t>-4&t<0)+1.*(t>0&t<2)+0.*(t>=2&t<=-4&t==0); subplot(211);
plot(t,f1); grid on;
title('f1=(t+1)/4.*(t>-4&t<0)+1.*(t>0&t<2)+0.*(t>=2&t<=-4)'); xlabel('t'); ylabel('f(t)');
%f2=0.25*((-2)*t+5).*(t>4&t<12)+1.*(t>0&t<4)+0.*(t>=12&t<=0&t== 4);
f2=-0.25*(t+1).*(t>2&t<4)+1.*(t>1&t<2)+0.*(t>=4&t<=1&t==2); subplot(212);
plot(t,f2); grid on;
title('f2=0.25*(-2*t+5).*(t>-4&t<0)+1.*(t>0&t<2)+0.*(t>=2&t<=-4&t= =0)');
xlabel('t'); ylabel('f(-2t+4)');
系统响应运算
3、已知描述系统的微分方程和激励信号e(t) 分别如下,试用解析方法求系统的单位冲激响应h(t)和零状态响应r(t),并用MATLAB绘出系统单位冲激响应和系统零状态响应的波形。
;
a=[1 4 4];
b=[1 3];
subplot(211)
impulse(b,a,4); %冲激响应函数
title('?μí3μ¥??3??¤?ìó|');
c=[1 4 4];
d=[1 3];
p1=0.001;
t=0:p1:10;
x1=exp(-t);
subplot(212)
%lsim(b,a,x1,t);
lsim(d,c,x1,t);
title('?μí3á?×′ì??ìó|');
思考题
1、如下图所示的电路中,已知,
,且两电感上初始电流分别为
,如果以电阻
上电压
作为系统输出,请求出系统在激励(v)作用下的全响应。
A=[-8 4;4 -8];
B=[1;0];
C=[4,-4];
D=[0];
x0=[2;0];
t=0:0.01:10; %控制坐标
E=[12.*ones(size(t))];
[r,x]=lsim(A,B,C,D,E,t,x0);
plot(t,r);
2、编写代码实现一个频率50Hz,占空比为50%和25%的周期矩形波(方波)信号。
t = -0.065:0.0001:0.065;
y1=square(2*pi*50*t,50);
subplot(211)
plot(t,y1);
axis([-0.0625 0.0625 -1.5 1.5]);
grid on;
y2=square(2*pi*50*t,25);
subplot(212)
plot(t,y2);
axis([-0.0625 0.0625 -1.5 1.5]); grid on;