首页 > 技术文章 > 信号与系统 MATLAB

Negan-ZW 2018-03-23 18:18 原文

信号与系统 MATLAB

1.求解零状态响应

  系统方程:y''(t)+4y'(t)+2y(t)=f'(t)+3f(t);激励信号:f(t)=exp(-t)u(t);求零状态响应。

t=0:0.01:10;

sys=tf([0 1 3],[1 4 4]);

f=exp(-t).*heaviside(t);

y=lsim(sys,f,t);plot(t,y);grid on;

title('第二问');xlabel('t');ylabel('y(t)');

2.求系统的冲击信号与阶跃信号

  系统1方程:y''(t)+3y'(t)+2y(t);系统2方程:y''(t)+2y'(t)+2y(t)=f'(t)。

t=0:0.01:10;
sys1=tf([0 0 1],[1 3 2]);
h1=impulse(sys1,t);
subplot(221);plot(t,h1);
grid on
title('冲击响应1');xlabel('t');ylabel('h1(t)');
g1=step(sys1,t);subplot(222);plot(t,g1);
grid on
title('阶跃响应1');xlabel('t');ylabel('g1(t)');
 
sys2=tf([0 1 0],[1 2 2]);
h2=impulse(sys2,t);subplot(223);plot(t,h2);
grid on
title('冲击响应2');xlabel('t');ylabel('h2(t)');
g2=step(sys2,t);subplot(224);plot(t,g2);
grid on
title('阶跃响应2');xlabel('t');ylabel('g2(t)');

 

 3.求卷积积分f1(t)*f2(t)

    f1(t)=f2(t)=u(t)-u(t-1)

dt=0.01;t=-1:dt:2;
f1=heaviside(t)-heaviside(t-1);
f2=heaviside(t)-heaviside(t-1);
f=conv(f1,f2)*dt;n=length(f);tt=(0:n-1)*dt-2;
subplot(221);plot(t,f1);grid on;
axis([-1 2 -0.5 1.5]);title('f1(t)');xlabel('t');ylabel('f1(t)');
subplot(222);plot(t,f2);grid on;
axis([-1 2 -0.5 1.5]);title('f2(t)');xlabel('t');ylabel('f2(t)');
subplot(212);plot(tt,f);grid on;
axis([-0.5 2.5 -0.5 1.5]);title('卷积结果');xlabel('t');ylabel('f(t)');

 4.系统函数的分析

% 利用MATLAB进行部分分式展开

format rat

num = [1 2];

den = [1 4 3 0];

[r,p,k]=residue(num,den);

 

% 利用MATLAB分析LTI系统的特性(系统函数)

% 画出系统函数的极零图

b = [1 2];

a = [1 4 3 0];

sym = tf(b,a);

pzmap(sym);

 

% 求拉普拉斯变换域逆变换

syms a t

F = laplace(sin(a*t));

f = ilaplace(F);

 

% 求系统函数F(jw)

b = [1 2];

a = [1 4 3 0];

 

h=freqs(b,a);

 

% 利用MATLAB进行部分分式展开format ratnum = [1 2];den = [1 4 3 0];[r,p,k]=residue(num,den);
% 利用MATLAB分析LTI系统的特性(系统函数)% 画出系统函数的极零图b = [1 2];a = [1 4 3 0];sym = tf(b,a);pzmap(sym);
% 求拉普拉斯变换域逆变换syms a tF = laplace(sin(a*t));f = ilaplace(F);
% 求系统函数F(jw)b = [1 2];a = [1 4 3 0];h=freqs(b,a);

 

推荐阅读