51 lines
697 B
Matlab
51 lines
697 B
Matlab
figure(1);
|
|
syms x;
|
|
t=-5:0.0001:5;
|
|
fx=heaviside(x+2)-heaviside(x-2);
|
|
ezplot(fx,[-5,5]);
|
|
|
|
figure(2);
|
|
fy=heaviside(x+0.2)-heaviside(x-0.2);
|
|
ezplot(fy,[-5,5]);
|
|
|
|
figure(3);
|
|
fz=heaviside(x+0.1)-heaviside(x-0.1);
|
|
ezplot(fz,[-5,5]);
|
|
|
|
figure(4);
|
|
fa=5*cos(12*pi*t)+6*cos(18*pi*t);
|
|
plot(t,fa);
|
|
|
|
figure(5);
|
|
fb=(cos(2*pi*t)).*(cos(2*pi*t));
|
|
plot(t,fb);
|
|
|
|
figure(6);
|
|
t = 0:0.1:10;
|
|
b1=[1,5,6];
|
|
a1=[1,5];
|
|
sys=tf(a1,b1);
|
|
y1=step(sys,t);
|
|
a2=[1,5];
|
|
b2=[1,2,5];
|
|
sys=tf(a2,b2);
|
|
y2=step(sys,t);
|
|
a3=[1.5];
|
|
b3=[1,2,1];
|
|
sys=tf(a3,b3);
|
|
y3=step(sys,t);
|
|
plot(t,y1,t,y2,'--',t,y3,'+');
|
|
|
|
figure(7);
|
|
sys=tf([1,2],[1,3,2]);
|
|
y=impulse(sys,t);
|
|
plot(t,y);
|
|
|
|
figure(8);
|
|
f=cos(t);
|
|
sys=tf([-1,2],[1,3,2]);
|
|
y=lsim(sys,f,t);
|
|
plot(t,f);
|
|
|
|
|
|
|