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/sig_sys/lab4.m

75 lines
947 B
Mathematica
Raw Normal View History

2022-05-27 16:35:34 +00:00
%% 1
a = [1, -1, 0, 0.9];
b = 1;
subplot(3,1,1);
impz(b,a);
subplot(3,1,2);
impz(b,a,60);
subplot(3,1,3);
impz(b,a,-10:40);
y = impz(b,a,-5:10);
display(y);
%% 2
a = [1, 0.4, -0.12];
b = [1, 2];
k = 0:10;
y=dstep(b,a,11);
stem(k,y);
display(y);
%% 3-1
syms n;
f = sym('1');
Z1 = ztrans(f);
display(Z1);
%% 3-2
syms a;
syms n;
f2 = a^n;
Z2 = ztrans(f2);
display(Z2);
%% 3-3
f3 = 0.5*n*(heaviside(n)-heaviside(n-5));
Z3 = ztrans(f3);
display(Z3);
%% 3-4
f4 = a^n*cos(n*pi/2)*heaviside(n);
Z4 = ztrans(f4);
display(f4);
display(Z4);
%% 4-1
syms n z;
f = (-1)^n*heaviside(n);
h = (-1)^n/3+2*3^n/3*heaviside(n);
F = ztrans(f);
H = ztrans(h);
Y = H*F;
y = iztrans(Y);
display(y);
%% 4-2
syms n z;
H = z*(7*z-2)/((z-0.2)*(z-0.5));
f = 1^n;
F = ztrans(f);
Y = F*H;
y = iztrans(Y);
display(y);
%% 5
a= [1 2^(1/2) 1];
b = [1 0 0];
subplot(2,1,1);
impz(b,a,-2:20);
display(impz(b,a,-2:20));
subplot(2,1,2);
p = roots(a);
z = roots(b);
zplane(z,p);