Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2009-05-13, 14:17   #1
azang
初级会员
 
注册日期: 2009-05-13
年龄: 38
帖子: 1
声望力: 0
azang 正向着好的方向发展
默认 求助找程序错误

校正了一天了,就是找不到哪里错了
%BiLinear Transformation:
%Butterworth Lowpass Filter Design
%Digital Filter Specifications:
wp=0.2*pi; % digital Passband freq in Hz
ws=0.3*pi;%digital Stopband freq in Hz
Rp=1;%Passband ripple in dB
As=15;%Stopband attenuation in dB
%Analog Prototype Specifications:Inverse map-ping for frequencies
T=1;Fs=1/T;%Set T=1
OmegaP=(2/T)*tan(wp/2);
OmegaS=(2/T)*tan(ws/2);
ep=sqrt(10^(Rp/10)-1);
Ripple=sqrt(1/(1+ep*ep));
Attn=1/(10^(As/20));
%Analog Butterworth Prototype Filter
Calculation:
[cs,ds]=afd_butt(OmegaP,OmegaS,Rp,As);
%%***Butterworth Filter Order=6
%Bilinear transformation:
[b,a]=bilinear(cs,ds,T);
[C,B,A]=dir2cas(b,a)
%%C=5.7969e-004
%%B=1.0000 2.0183 1.0186
%%1.0000 1.9814 0.9817
%%1.0000 2.0004 1.0000
%%A=1.0000 -0.9459 0.2342
%% 1.0000 -1.0541 0.3753
%% 1.0000 -1.3143 0.7149
% Plotting
figure(1);subplot(1,1,1)
[db,mag,pha,grd,w]=freqz_m(b,a);
subplot(2,2,1);plot(w/pi,mag);title(‘Magnitude Response');
xlabel(‘frequency in pi units’);ylabel(‘|H|');axis([0,1,0,1.1])
set(gca,’XTickMode’,'manual','XTick',[0,0.2,0.3,1]);
set(gca,'YTickmode','manual','YTick',[0,Attn,Ripple,1]);grid;
subplot(2,2,3);plot(w/pi,db);title('Magnitude in dB');
xlabel('frequency in pi units');ylabel('decibels');
xis([0,1,-40,5]);
set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1]);
set(gca,'YTickmode','manual','YTick',[-50,-15,-1,0]);grid;
set(gca,'YTickLabelMode','manual',’YTickLabels',['50';'15';'1';'0'])
subplot(2,2,2);plot(w/pi,pha/pi);title('Phase Response')
xlabel('frequency in pi units');ylabel('pi units');
xis([0,1,-1,1]);
set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1]);
set(gca,'YTickmode','manual','YTick',[-1,0,1]);grid
subplot(2,2,4);plot(w/pi,grd);title('Group Delay')
xlabel('frequency in pi units');ylabel('Samples');
xis([0,1,0,10])
set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1]);
set(gca,'YTickmode','manual','YTick',[0:2:10]);grid;
运行后的提示

??? Calculation:
|
Error: Incomplete or misformed expression or statement.
azang 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 20:18


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.