Ts=;
t=-1:Ts:2;
f1=(t>=0)-(t>=1);
f2=1/2*t+1/2*[(t>=-1)-(t>=2)];
y=conv(f1,f2)*Ts;
L=length(y);
k=(
Ts=;
t=-1:Ts:2;
f1=(t>=0)-(t>=1);
f2=1/2*t+1/2*[(t>=-1)-(t>=2)];
y=conv(f1,f2)*Ts;
L=length(y);
k=(0:L-1)*Ts-2;
subplot(221);
plot(t,f1);grid on;title('f1');
subplot(222);
plot(t,f2);grid on;title('f2');
subplot(212);
plot(k,y);grid on;title('f1与f2的卷积积分');
Ts=;
t=-2:Ts:6;
f1=(t>=0)-(t>=1);
f2=(1/2)*[(t>=1)-(t>=3)];
y=conv(f1,f2)*Ts;
L=length(y);
k=(0:L-1)*Ts-4;
subplot(221);
plot(t,f1);grid on;title('f1');
subplot(222);
plot(t,f2);grid on;title('f2');
subplot(212);
plot(k,y);grid on;title('f1与f2的卷积积分');
a=[2 1 8];
b=[0 1];
subplot(1,2,1);impulse(b,a,0::30);
subplot(1,2,2);step(b,a,0::30);
a=[2 1 8];
b=[0 1];
y=impulse(b,a,0::30)'
h=step(b,a,0::30)’
t=0::8;
a=[1 5 6];b=[1 5];h1=step(b,a,t);
a=[1 2 6];b=[1 5];h2=step(b,a,t);
a=[1 2 1];b=[1 5];h3=step(b,a,t);
plot(t,h1,'g',t,h2,'b--',t,h3,'r--');
xlabel('t');title('danweichongji');
legend('h_1(t)','h_2(t)','h_3(t)');
a=[1 3 2];b=[-1 2];sys=tf(b,a);
t=0::5;
u=(t>=0);
f=cos(t).*u;
subplot(1,2,1);
lsim(sys,f,t);
subp
matlab实验5 来自淘豆网m.daumloan.com转载请标明出处.