|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
我编了一个滤波器的程序,出现下列问题,请各位帮忙改改!谢谢!
程序:
clear;
clc;
close all hidden;
fni=input('wenjian:','s');
fid=fopen(fni,'r');
fs=fscanf(fid,'%f',1);
fun=fscanf(fid,'%d',3);
mod=fscanf(fid,'%d',1);
if fun<=2
wp=fscanf(fid,'%f',1);
ws=fscanf(fid,'%f',1);
else
wp=fscanf(fid,'%f',2);
ws=fscanf(fid,'%f',2);
end
rp=fscanf(fid,'%f',1);
rs=fscanf(fid,'%f',1);
fno=fscanf(fid,'%s',1);
x=fscanf(fid,'%f',[1,inf]);
status=fclose(fid);
switch fun
case 1
ft='low';
case 2
ft='high';
case 3
ft='bandpass';
case 4
ft='stop';
otherwise
ft='low';
end
switch mod
case 1
[n wn]=buttord(wp/(fs/2),ws/(fs/2),rp,rs);
[b a]=butter(n,wn,ft);
case 2
[n wn]=cheb1ord(wp/(fs/2),ws/(fs/2),rp,rs);
[b a]=cheby1(n,rp,wn,ft);
case 3
[n wn]=cheb2ord(wp/(fs/2),ws/(fs/2),rp,rs);
[b a]=cheby2(n,rs,wn,ft);
case 4
[n wn]=ellipbuttord(wp/(fs/2),ws/(fs/2),rp,rs);
[b a]=ellip(n,rp,rs,wn,ft);
end
出现的问题:
??? SWITCH expression must be a scalar or string constant.
Error in ==> filterwo2 at 33
switch mod
谢谢各位!
[ 本帖最后由 eight 于 2007-9-15 10:25 编辑 ] |
|