c=input('C=');
rc=input('RC=');
b=[c];
a=[rc,1];
printsys(b,a,'s')
[Hz,w]=freqs(b,a);
w=w./pi;
magh=abs(Hz);
zerosIndex=find(magh==0);
magh=20*log10(magh);
magh(zerosIndex)=-inf;
angh=angle(Hz);
angh=unwrap(angh)*180/pi;
figure
subplot(1,2,1)
plot(w,magh);
grid on
xlabel('特征角频率(\time\pi rads/sample)')
ylabel('c=50;rc=200')
title('幅频特性曲线|H(w)|(db)');
subplot(1,2,2)
plot(w,angh);
grid on
xlabel('特性角频率(\time\pi rads/sample)')
title('相角特性曲线\theta(w)(degrees)');
信号f(t)=cos(100t)+cos(3000t)包含了一个低频分量和一个高频分量。确定适当的RC值,滤除信号中的高频分量并画出信号f(t)和y(t)在t=0~0.2s范围内的波形。
t=0:0.001:0.2;rc=4145;
ft=cos(100*t)+cos(3000*t);
subplot(2,1,1);
plot(t,ft);
w1=2*pi/100;w2=2*pi/3000;
phi2=angle(1/(1+j*w2*rc));
phi1=angle(1/(1+j*w1*rc));
y1=abs(1/(1+j*w1*rc))*cos(phi1+100*t);
y2=abs(1/(1+j*w2*rc))*cos(3000*t+phi2);
y=y1+y2;
subplot(2,1,2);
plot(t,y);