声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 5292|回复: 11

[编程技巧] SWITCH expression must be a scalar or string constant 出错请教

[复制链接]
发表于 2007-9-14 15:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

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 编辑 ]
回复
分享到:

使用道具 举报

发表于 2007-9-14 16:01 | 显示全部楼层

回复 #1 jingrenzhi 的帖子

这是不是王济那本书上的程序?
 楼主| 发表于 2007-9-14 16:48 | 显示全部楼层

回复 #2 zhangnan3509 的帖子

不知道,是朋友给的!
 楼主| 发表于 2007-9-14 17:06 | 显示全部楼层

回复 #2 zhangnan3509 的帖子

有啥问题吗?我也没有看明白!是同学的!
发表于 2007-9-14 22:25 | 显示全部楼层
能不能把你要导入的文件也附上来啊~~~
 楼主| 发表于 2007-9-14 23:00 | 显示全部楼层

回复 #5 zhj0231984 的帖子

你好,我想问的是设计带通滤波器,频率需要设置成二元向量,在matlab程序中怎么设置?我不会用附件形式传上来!你帮忙看一下!
我的数据是
"3.438134e-02
1.299897e-02
4.898164e-03
1.639001e-02
7.629832e-03
-1.525966e-02
-8.195004e-03
1.789714e-02
1.752036e-02
8.948568e-03
1.120926e-02
1.902748e-02
3.061352e-02
2.486760e-02
1.309317e-02
2.015783e-02
2.128817e-02
5.463337e-03
2.825864e-03
1.836811e-02
2.985996e-02
7.441441e-03
-1.535386e-02
-8.289200e-03
4.898164e-03
4.332991e-03
-8.948568e-03
-8.665982e-03
7.347246e-03
1.573064e-02
3.579427e-03
-5.274945e-03
6.499487e-03
1.309317e-02
8.948568e-03
1.120926e-02
2.251271e-02
1.469449e-02
6.876268e-03
0.000000e+00
1.224541e-03
6.311096e-03
-3.108450e-03
-1.488288e-02
-1.865070e-02
-1.422351e-02
-9.796328e-03
-1.799133e-02
-2.185335e-02
-8.571787e-03
7.818223e-03
5.274945e-03
-3.767818e-03
6.405291e-03
1.092667e-02
4.144600e-03
4.050405e-03
1.403512e-02
2.722249e-02
3.532330e-02
1.959266e-02
9.702132e-03
1.026731e-02
-2.166495e-03
-1.883909e-02
-1.601323e-02
-4.709773e-04
4.992359e-03
3.485232e-03
4.521382e-03
1.384673e-02
1.403512e-02
1.460030e-02
1.168024e-02
1.686099e-02
2.505599e-02
1.959266e-02
8.006614e-03
1.384673e-02
2.279530e-02
1.695518e-02
9.796328e-03
5.274945e-03
3.767818e-03
2.920059e-03
1.789714e-03
6.405291e-03
1.111506e-02
9.702132e-03
4.615577e-03
-1.695518e-03
-3.014255e-03
1.196282e-02
7.064659e-03
2.072300e-03
3.391037e-03
3.767818e-04
-6.876268e-03
-1.733196e-02
-9.231155e-03
-4.709773e-04
-1.130346e-03
7.724028e-03
9.607936e-03
3.485232e-03
5.463337e-03
2.825864e-03
-6.593682e-04
-9.042764e-03
-1.375254e-02
-2.053461e-02
-2.985996e-02
-1.290478e-02
-4.050405e-03
-1.036150e-03
3.391037e-03
1.695518e-03
7.441441e-03
6.122705e-03
6.311096e-03
1.054989e-02
2.062880e-02
2.976576e-02
1.610742e-02
8.289200e-03
1.789714e-02
1.233961e-02
7.818223e-03
5.651727e-03
9.419546e-05
-9.419546e-04
-4.521382e-03
-4.050405e-03
-1.318736e-03
-6.593682e-04
-3.202646e-03
-5.557532e-03
-7.535637e-04
1.064409e-02
1.846231e-02
1.290478e-02
1.563645e-02
2.449082e-02
2.693990e-02
1.733196e-02
1.412932e-03
3.296841e-03
9.042764e-03
-2.825864e-04
-3.202646e-03
-1.224541e-03
-3.014255e-03
-4.332991e-03
-9.419546e-03
-1.507127e-02
-1.535386e-02
-1.535386e-02
-1.252800e-02
-3.014255e-03
1.083248e-02
1.902748e-02
9.796328e-03
5.651727e-03
8.760178e-03
2.260691e-03
1.789714e-03
5.934314e-03
-1.412932e-03
-3.202646e-03
-4.427187e-03
-1.290478e-02
-1.695518e-02
-1.111506e-02
-3.108450e-03
-6.122705e-03
-2.166495e-03
3.767818e-04
-1.318736e-03
-7.158855e-03
-6.216900e-03
1.196282e-02
2.401984e-02
1.299897e-02
-2.336047e-02
-4.285893e-02
-1.111506e-02
-6.970464e-03
-7.026981e-02
-8.929729e-02
-9.918781e-02
-1.974337e-01
-2.990706e-01
-3.438134e-01
-3.846942e-01
-4.746509e-01
-5.537751e-01
-5.907939e-01
-6.447679e-01
-6.131182e-01
-5.446382e-01
-5.429426e-01
-4.903815e-01
-3.716011e-01
-2.456618e-01
-1.725661e-01
-7.083499e-02
4.709773e-04
5.915475e-02
1.217005e-01
1.138823e-01
8.430494e-02
4.992359e-02
-1.563645e-02
-1.246206e-01
-1.906516e-01
-2.434011e-01
-3.142360e-01
-3.459799e-01
-3.651016e-01
-3.678333e-01
-3.151780e-01
-2.526322e-01
-2.107152e-01
-1.173675e-01
9.796328e-03
8.892051e-02
1.532560e-01
2.394449e-01
2.916291e-01
3.098089e-01
3.004835e-01
2.514077e-01
2.007305e-01
1.647478e-01
1.035208e-01
0.000000e+00
-5.971992e-02
-9.702132e-02
-1.940426e-01
-1.939484e-01
-1.710590e-01
-1.532560e-01
-9.815167e-02
-3.758399e-02
3.259163e-02
1.659724e-01
2.669499e-01
3.002951e-01
3.543633e-01
3.992946e-01
4.056998e-01
3.673623e-01
3.274234e-01
2.717539e-01
1.987524e-01
1.137881e-01
2.458501e-02
-1.883909e-02
-1.215121e-02
-2.637473e-02
-8.505850e-02
-1.520315e-01
-1.295187e-01
-7.582735e-02
2.119398e-02
1.245264e-01
1.838695e-01
2.655370e-01
3.071714e-01
3.432482e-01
3.627467e-01
3.695288e-01
3.481464e-01
2.981286e-01
2.385971e-01
1.760513e-01
9.127539e-02
2.373726e-02
-4.803968e-03
-3.975048e-02
-1.217947e-01
-1.473217e-01
-1.341343e-01
-1.120926e-01
-4.719193e-02
2.750507e-02
1.110564e-01
1.864128e-01
2.379377e-01
3.057584e-01
3.419295e-01
3.449438e-01
3.473929e-01
3.082075e-01
2.556465e-01
1.954556e-01
1.541038e-01
9.118120e-02
3.871433e-02
3.560588e-02
-4.182278e-02
-1.394093e-01
-1.333808e-01
-1.201934e-01
-8.656562e-02
-2.486760e-02
8.665982e-03
7.328407e-02
2.069474e-01
2.823980e-01
3.112218e-01
3.460741e-01
3.381617e-01
3.245975e-01
2.785360e-01
2.294601e-01
1.620162e-01
7.102337e-02
2.599795e-02
9.513741e-03
-6.424130e-02
-1.517489e-01
-1.610742e-01
-1.620162e-01
-1.541038e-01
-1.240554e-01
-1.282942e-01
-9.532581e-02
2.835283e-02
1.970569e-01
2.374668e-01
2.701526e-01
2.956795e-01
2.760869e-01
2.693990e-01
2.304963e-01
1.695518e-01
9.136959e-02
2.307789e-02
-4.653256e-02
-1.067235e-01
-1.517489e-01
-1.593787e-01
-1.550457e-01
-1.535386e-01
-1.342285e-01
-9.560839e-02
-2.449082e-02
4.154020e-02
9.758649e-02
1.775584e-01
2.097733e-01
2.453792e-01
2.570594e-01
2.412346e-01
2.201348e-01
1.804785e-01
1.565529e-01
1.203818e-01
3.890272e-02
-1.846231e-02
-6.442969e-02
-1.225483e-01
-1.502417e-01
-1.569296e-01
-1.450610e-01
-1.113390e-01
-4.163439e-02
2.580955e-02
6.913947e-02
1.144475e-01
1.582484e-01
1.913110e-01
2.043099e-01
2.087371e-01
1.990350e-01
1.524082e-01
1.039918e-01
6.763234e-02
2.552697e-02
-3.089611e-02
-7.940677e-02
-1.216063e-01
-1.421409e-01
-1.670085e-01
-1.635233e-01
-1.239612e-01
-8.816694e-02
-4.926422e-02
-1.384673e-02
5.623469e-02
9.777489e-02
1.238670e-01
1.429887e-01
1.491114e-01
1.408222e-01
1.191573e-01
8.703660e-02
4.370669e-02
-1.883909e-04
-2.731668e-02
-3.494652e-02
-3.343939e-02
-5.011198e-02
-1.151069e-01
-1.728487e-01
-1.473217e-01
-1.331924e-01
-1.272581e-01
-9.287672e-02
-1.959266e-02
3.890272e-02
6.103865e-02
9.617356e-02
9.758649e-02
8.637723e-02
6.998722e-02
5.689406e-02
2.034622e-02
-2.166495e-02
-4.370669e-02
-7.008142e-02
-8.854373e-02
-1.144475e-01
-1.507127e-01
-1.325330e-01
-1.227367e-01
-1.222657e-01
-1.075712e-01
-8.402235e-02
-1.987524e-02
2.260691e-03
1.384673e-02
5.105394e-02
6.612521e-02
7.074079e-02
5.604630e-02
4.135181e-02
1.940426e-02
-1.337575e-02
-4.888744e-02
-6.235739e-02
-6.904527e-02
-9.287672e-02
-1.022963e-01
-1.080422e-01
-1.070060e-01
-9.127539e-02
-8.948568e-02
-7.893579e-02
-4.662675e-02
7.535636e-03
2.486760e-02
3.673623e-02
6.141544e-02
6.094446e-02
4.869905e-02
2.863542e-02
1.770875e-02
-1.130346e-03
-2.712829e-02
-4.361250e-02
-4.521382e-02
-4.351830e-02
-5.322043e-02
-7.460281e-02
-8.345717e-02
-6.970464e-02
-6.951625e-02
-6.395871e-02
-3.701881e-02
1.883909e-03
1.064409e-02
1.120926e-02
3.089611e-02
4.201118e-02
4.069244e-02
2.260691e-02
9.607936e-03
-3.579427e-03
-2.109978e-02
-3.852594e-02
-4.888744e-02
-4.587319e-02
-4.502543e-02
-4.417767e-02
-4.257635e-02
-4.370669e-02
-4.154020e-02
-3.824336e-02
-2.279530e-02
-3.579427e-03
-6.405291e-03
1.224541e-03
1.865070e-02
2.091139e-02
1.394093e-02
-2.543277e-03
-3.391037e-03
-2.543277e-03
-1.233961e-02
-2.044041e-02
-2.392565e-02
-2.722249e-02
-3.164968e-02
-3.240324e-02
-3.541749e-02
-3.353358e-02
-2.298369e-02
-1.384673e-02
-7.253050e-03
1.695518e-03
-3.485232e-03
-1.130345e-02
-1.168024e-02
-1.243380e-02
-7.064659e-03
1.130346e-03
7.253050e-03
2.920059e-03
-1.318736e-03
-8.383396e-03
-1.601323e-02
-1.431771e-02
-1.281058e-02
-1.940426e-02
-1.752036e-02
-1.450610e-02
-8.289200e-03
-2.354886e-03
-4.332991e-03
-1.601323e-03
-2.920059e-03
-3.014255e-03
4.709773e-04
-3.862014e-03
-8.006614e-03
-9.231155e-03
-1.865070e-02
-1.827392e-02
-1.158604e-02
-8.006614e-03
1.789714e-03
6.593682e-03
3.862014e-03
6.593682e-04
-1.130346e-03
-1.318736e-03
-8.100810e-03
-1.149185e-02
-1.111506e-02
-1.007891e-02
-4.992359e-03
-2.449082e-03
-2.166495e-03
2.825864e-04
5.651728e-04
7.535637e-04
2.637473e-03
1.978105e-03
9.419546e-04
-6.687877e-03
-7.347246e-03
-6.216900e-03
-6.405291e-03
-4.709773e-04
-1.978105e-03
-4.709773e-04
3.673623e-03
-1.224541e-03
3.485232e-03
5.274945e-03
-3.296841e-03
-7.535636e-03
-7.818223e-03
-6.782073e-03
-7.535636e-03
-8.571787e-03
-1.186863e-02
-1.186863e-02
-5.463337e-03
-1.318736e-03
-4.709773e-03
-7.158855e-03
-8.854373e-03
-1.139765e-02
-1.337575e-02
-5.086555e-03
-9.419546e-04
-1.158604e-02
-1.582484e-02
-1.591903e-02
-7.818223e-03
-7.535637e-04
-4.803968e-03
-4.144600e-03
-2.166495e-03
1.789714e-03
5.840119e-03
1.978105e-03
1.601323e-03
3.862014e-03
-1.507127e-03
-1.507127e-03
-4.050405e-03
-9.702132e-03
-1.168024e-02
-9.513741e-03
1.883909e-04
7.535636e-03
5.745923e-03
4.238795e-03
-9.419546e-04
-3.108450e-03
-4.521382e-03
-1.318736e-03
7.347246e-03
5.745923e-03
3.862014e-03
-3.956209e-03
-1.309317e-02
-1.309317e-02
-1.356415e-02
-1.441190e-02
-9.984719e-03
-9.419546e-04
8.383396e-03
9.513741e-03
6.122705e-03
3.202646e-03
2.920059e-03
4.144600e-03
-1.130346e-03
-3.108450e-03
4.992359e-03
9.136959e-03
7.158855e-03
1.507127e-03
-2.731668e-03
8.477591e-04
-2.543277e-03
-8.854373e-03
-9.607936e-03
-8.477591e-03
-4.992359e-03
9.419546e-04
5.274945e-03
6.970464e-03
1.168024e-02
1.337575e-02
5.557532e-03
8.477591e-04
5.651728e-04
1.412932e-03
5.086555e-03
6.405291e-03
6.593682e-04
-1.412932e-03
-5.274945e-03
-1.026731e-02
-6.216900e-03
-8.477591e-04
8.948568e-03
1.224541e-02
6.311096e-03
-1.789714e-03
-1.412932e-03
6.593682e-04
-6.216900e-03
-3.014255e-03
7.347246e-03
8.571787e-03
4.615577e-03
4.238795e-03
-2.354886e-03
-2.920059e-03
-5.557532e-03
-4.615577e-03
5.369141e-03
1.083248e-02
1.111506e-02
9.984719e-03
1.233961e-02
9.136959e-03
1.083248e-02
9.419546e-03
5.463337e-03
-4.709773e-03
-7.724028e-03
0.000000e+00
-7.535637e-04
-8.665982e-03
-9.136959e-03
-2.260691e-03
5.651727e-03
1.205702e-02
5.557532e-03
-9.419546e-04
1.601323e-03
6.216900e-03
3.391037e-03
-2.166495e-03
-2.354886e-03
-5.651728e-04
-5.651727e-03
-1.704938e-02
-1.902748e-02
-1.281058e-02
-9.231155e-03
-4.803968e-03
6.311096e-03
1.205702e-02
1.026731e-02
1.139765e-02
4.803968e-03
1.412932e-03
7.818223e-03
3.014255e-03
2.825864e-04
-1.883909e-04
4.898164e-03
1.036150e-02
6.876268e-03
3.485232e-03
-3.108450e-03
-9.136959e-03
-8.289200e-03
-7.347246e-03
-8.477591e-03
-8.289200e-03
-3.485232e-03
1.789714e-03
4.615577e-03
1.252800e-02
1.968685e-02
1.290478e-02
6.499487e-03
3.673623e-03
-9.419546e-05
-2.166495e-03
-3.296841e-03
3.767818e-03
1.215121e-02
1.073828e-02
8.383396e-03
3.673623e-03
-6.782073e-03
-9.419546e-03
-8.854373e-03
-1.036150e-03
9.325351e-03
9.231155e-03
5.651727e-03
8.477591e-04
-3.767818e-03
-7.535637e-04
2.166495e-03
9.231155e-03
1.158604e-02
1.036150e-02
9.702132e-03
7.724028e-03
2.449082e-03
-7.629832e-03
-8.571787e-03
-7.253050e-03
-6.216900e-03
-1.883909e-03
2.920059e-03
6.876268e-03
3.108450e-03
-5.369141e-03
-2.543277e-03
1.978105e-03
3.202646e-03
6.499487e-03
5.651728e-04
-7.818223e-03
-1.007891e-02
-7.724028e-03
-4.050405e-03
-1.412932e-03
8.477591e-04
9.419546e-04
9.513741e-03
1.478869e-02
8.854373e-03
-5.651728e-04
-2.072300e-03
2.920059e-03
9.890523e-03
6.216900e-03
5.651728e-04
6.593682e-03
2.920059e-03
2.072300e-03
6.311096e-03
-4.709773e-04
-1.789714e-03
8.477591e-04
1.073828e-02
9.419546e-03
9.419546e-04
1.601323e-03
4.050405e-03
9.325351e-03
1.328156e-02
1.488288e-02
1.450610e-02
7.724028e-03
-4.709773e-04
-8.289200e-03
-1.036150e-02
-3.767818e-03
3.485232e-03
6.311096e-03
2.920059e-03
6.593682e-04
3.767818e-04
-6.593682e-04
-2.449082e-03
1.130346e-03
8.948568e-03
1.422351e-02
6.593682e-03
-1.036150e-03
3.767818e-03
8.854373e-03
1.328156e-02
7.818223e-03
1.601323e-03
3.579427e-03
2.072300e-03
-3.767818e-04
2.731668e-03
1.139765e-02
1.281058e-02
1.412932e-02
1.403512e-02
9.325351e-03
9.419546e-04
-1.130346e-03
9.419546e-05
4.709773e-04
3.202646e-03
9.419546e-05
-3.673623e-03
-3.579427e-03
-3.673623e-03
1.036150e-03
9.136959e-03
1.064409e-02
1.252800e-02
1.422351e-02
1.356415e-02
6.876268e-03
2.637473e-03
-2.731668e-03
-4.050405e-03
-9.419546e-04
-3.673623e-03
-4.050405e-03
-3.673623e-03
-5.463337e-03
-5.086555e-03
2.449082e-03
7.347246e-03
5.840119e-03
8.289200e-03
1.073828e-02
7.724028e-03
6.593682e-04
-4.992359e-03
5.557532e-03
1.507127e-02
1.328156e-02
1.365834e-02
9.513741e-03
7.441441e-03
9.890523e-03
7.253050e-03
2.825864e-04
-9.419546e-05
1.224541e-03
1.978105e-03
2.731668e-03
9.419546e-04
-7.724028e-03
-1.865070e-02
-1.328156e-02
-2.260691e-03
1.036150e-03
-8.477591e-04
-3.862014e-03
-6.970464e-03
-9.890523e-03
-9.796328e-03
-1.092667e-02
-9.607936e-03
-9.419546e-03
-6.499487e-03
-1.318736e-03
1.478869e-02
1.996944e-02
1.017311e-02
1.036150e-02
8.289200e-03
8.383396e-03
1.262219e-02
1.460030e-02
1.582484e-02
1.205702e-02
7.441441e-03
2.072300e-03
-5.274945e-03
-7.629832e-03
-6.782073e-03
-7.347246e-03
-1.102087e-02
-1.271639e-02
-1.120926e-02
-8.948568e-03
-8.006614e-03
-6.311096e-03
-4.050405e-03
-2.260691e-03
1.695518e-03
6.970464e-03
9.513741e-03
8.571787e-03
1.073828e-02
3.956209e-03
9.419546e-05
-4.992359e-03
-9.231155e-03
-1.789714e-03
-3.767818e-04
2.449082e-03
8.760178e-03
9.796328e-03
7.912419e-03
8.195004e-03
4.332991e-03
7.535637e-04
-3.862014e-03
1.601323e-03
1.054989e-02
9.513741e-03
8.100810e-03
1.196282e-02
1.092667e-02
9.890523e-03
2.825864e-04
-6.311096e-03
1.883909e-03
6.122705e-03
9.513741e-03
8.195004e-03
6.876268e-03
7.441441e-03
2.731668e-03
6.876268e-03
6.216900e-03
2.072300e-03
1.092667e-02
1.431771e-02
1.799133e-02
1.281058e-02
6.782073e-03
1.007891e-02
6.970464e-03
1.978105e-03
-4.332991e-03
-8.760178e-03
1.412932e-03
1.054989e-02
1.149185e-02
1.130345e-02
5.934314e-03
-1.412932e-03
2.825864e-04
2.449082e-03
1.883909e-03
-2.637473e-03
-5.369141e-03
-4.427187e-03
4.615577e-03
1.054989e-02
2.260691e-03
3.391037e-03
4.803968e-03
1.695518e-03
-4.898164e-03
-8.948568e-03
-3.673623e-03
-5.745923e-03
-5.651727e-03
-6.122705e-03
-1.610742e-02
-1.158604e-02
-8.854373e-03
-1.036150e-02
-8.854373e-03
-1.186863e-02
-9.231155e-03
-2.166495e-03
1.102087e-02
1.469449e-02
1.337575e-02
1.205702e-02
3.202646e-03
-1.318736e-03
-1.130346e-03
8.477591e-04
1.017311e-02
1.497708e-02
1.196282e-02
1.525966e-02
1.243380e-02
1.120926e-02
1.516547e-02
1.431771e-02
5.651727e-03
-3.767818e-04"
发表于 2007-9-15 08:46 | 显示全部楼层
从程序和数据来看,是楼主给出的数据格式和程序不配。在程序中要从数据文件读入:
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]);
fs, fun, mod, wp,ws, rp, rs, fno和x,但楼主的数据文件只给出x的数据。
发表于 2007-9-15 09:40 | 显示全部楼层
发这么长的数据 好像水贴一样

呵呵 飘过
发表于 2007-9-15 10:25 | 显示全部楼层
原帖由 jingrenzhi 于 2007-9-14 15:53 发表
我编了一个滤波器的程序,出现下列问题,请各位帮忙改改!谢谢!
程序:
     clear;
clc;
close all hidden;
fni=input('wenjian:','s');
fid=fopen(fni,'r');
fs=fscanf(fid,'%f',1);
fun=fscanf(fid,'%d' ...


先看看 switch 函数的用法,然后自己设置断点调试一下

ps:下次贴数据请使用附件,这样直接贴上来阅读不方便
 楼主| 发表于 2007-9-15 15:58 | 显示全部楼层

回复 #7 songzy41 的帖子

谢谢,我也是刚开始学习matlab,很多地方不懂,以后多指教!:@)
 楼主| 发表于 2007-9-15 16:19 | 显示全部楼层

回复 #7 songzy41 的帖子

你好,我想问的是设计带通滤波器,频率需要设置成二元向量,在matlab程序中怎么设置?
 楼主| 发表于 2007-9-27 14:27 | 显示全部楼层

回复 #2 zhangnan3509 的帖子

你好!你说的"王济的书"是本啥样的书?书名是啥?
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-12-12 05:36 , Processed in 0.063249 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表