This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/Matlab/lab3.m
2022-05-12 12:15:18 +08:00

60 lines
No EOL
881 B
Matlab

%% 1
figure(1);
syms t;
f = cos(2*t)*sin(3*t)*heaviside(t);
L = laplace(f);
subplot(2,1,1);
ezplot(f);
subplot(2,1,2);
display(L);
ezplot(L);
%% 2
figure(2);
syms s;
H1 = ((s+1)*(s+4))/(s*(s+2)*(s+3));
f1 = ilaplace(H1);
H2 = (s^3+5*s^2+9*s+7)/(s^2+3*s+2);
f2 = ilaplace(H2);
subplot(2,1,1);
ezplot(f1);
display(f2);
subplot(2,1,2);
display(f2);
ezplot(f2);
%% 3
figure(3);
a = [1, 0, 1];
b = [1,2,-3,3,3,2];
sys = tf(a, b);
pzmap(sys);
%% 4
figure(4);
a = [1, 5];
b = [1, 5, 6];
t = 0:0.01:10;
h = impulse(a, b, t);
subplot(3, 1, 1);
plot(t, h);
title('单位冲激响应');
syms s t;
H = (s+5)/(s^2+5*s+6);
F = laplace(heaviside(t));
Y = H*F;
y = ilaplace(Y);
subplot(3, 1, 2);
fplot(y*heaviside(t));
title('单位阶跃响应');
f = exp(-t)*heaviside(t);
Fs = laplace(f);
Ys = H*Fs;
yts = ilaplace(Ys);
subplot(3, 1, 3);
fplot(yts*heaviside(t));
title('零状态响应');