[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I have modified firls.m to include all types of FIRs plus HT and dif
From: |
Nicholas Jankowski |
Subject: |
Re: I have modified firls.m to include all types of FIRs plus HT and diff |
Date: |
Tue, 16 May 2017 15:16:29 -0400 |
On Tue, May 16, 2017 at 3:02 PM, Nicholas Jankowski <address@hidden> wrote:
> On Tue, May 16, 2017 at 1:28 PM, je suis <address@hidden> wrote:
ok, Matlab help for firls has the following as test inputs to firls:
% Example of a length 31 lowpass filter.
h=firls(30,[0 .1 .2 .5]*2,[1 1 0 0]);
% Example of a length 45 lowpass differentiator.
h=firls(44,[0 .3 .4 1],[0 .2 0 0],'differentiator');
% Example of a length 26 type 4 highpass filter.
h=firls(25,[0 .4 .5 1],[0 0 1 1],'h');
Your code errors out on all three, so there's a bit of a Matlab
compatibility issue. Here are the Octave outputs:
>> h=lsfir2(30,[0 .1 .2 .5]*2,[1 1 0 0])'
warning: function name 'firls' does not agree with function filename
'C:\Users\nicholas.jankowski\Deskt
op\test\lsfir2.m'
error: For three input arguments, the frequency and weight vectors
must not have a size greater than 2.
error: called from
lsfir2 at line 110 column 4
>> h=lsfir2(44,[0 .3 .4 1],[0 .2 0 0],'differentiator')'
warning: implicit conversion from numeric to char
warning: called from
lsfir2 at line 144 column 3
error: lsfir2: operator *: nonconformant arguments (op1 is 45x4, op2 is 28x1)
error: called from
lsfir2 at line 148 column 3
>> h=lsfir2(25,[0 .4 .5 1],[0 0 1 1],'h')'
warning: implicit conversion from numeric to char
warning: called from
lsfir2 at line 144 column 3
error: lsfir2: operator *: nonconformant arguments (op1 is 26x4, op2 is 2x1)
error: called from
lsfir2 at line 148 column 3
For reference, here are the Matlab 2017a outputs. (matlab outputs h
in as a row vector. display is rotated to column vector for
convenience)
>> format long
>> h=firls(30,[0 .1 .2 .5]*2,[1 1 0 0]);h'
ans =
0.001271997764274
0.001759732488755
-0.000474050123699
-0.005076557781510
-0.007306227791006
-0.001398349858936
0.011818230551013
0.020860039466545
0.010850963397743
-0.020194873809769
-0.050342139829269
-0.042607589983231
0.027300296130929
0.144919701151268
0.257048286517310
0.303233271924368
0.257048286517310
0.144919701151268
0.027300296130929
-0.042607589983231
-0.050342139829269
-0.020194873809769
0.010850963397743
0.020860039466545
0.011818230551013
-0.001398349858936
-0.007306227791006
-0.005076557781510
-0.000474050123699
0.001759732488755
0.001271997764274
>> h=firls(44,[0 .3 .4 1],[0 .2 0 0],'differentiator');h'
ans =
-0.000196566503466
-0.000331109449953
0.000451753691513
0.000917072903695
0.000068070186189
-0.001369836371904
-0.001430920748526
0.000617750911244
0.002694234626665
0.001814598671639
-0.001991887076241
-0.004577095042312
-0.001878777817360
0.004499973574131
0.007355400044440
0.001352920990926
-0.009317947687786
-0.012579557571954
-0.000058756249661
0.022265490917473
0.036470607272392
0.028014514414634
0
-0.028014514414634
-0.036470607272392
-0.022265490917473
0.000058756249661
0.012579557571954
0.009317947687786
-0.001352920990926
-0.007355400044440
-0.004499973574131
0.001878777817360
0.004577095042312
0.001991887076241
-0.001814598671639
-0.002694234626665
-0.000617750911244
0.001430920748526
0.001369836371904
-0.000068070186189
-0.000917072903695
-0.000451753691513
0.000331109449953
0.000196566503466
>> h=firls(25,[0 .4 .5 1],[0 0 1 1],'h');h'
ans =
-0.004214004475093
0.010158504328219
0.010872743291530
-0.012347270923537
-0.021784061945701
0.011072745424400
0.038152378814080
-0.002854545303196
-0.063316155566517
-0.020963226060468
0.113467223601173
0.110544374559510
-0.482742376597236
0.482742376597236
-0.110544374559510
-0.113467223601173
0.020963226060468
0.063316155566517
0.002854545303196
-0.038152378814080
-0.011072745424400
0.021784061945701
0.012347270923537
-0.010872743291530
-0.010158504328219
0.004214004475093
- I have modified firls.m to include all types of FIRs plus HT and diff, je suis, 2017/05/16
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, Nicholas Jankowski, 2017/05/16
- Re: I have modified firls.m to include all types of FIRs plus HT and diff,
Nicholas Jankowski <=
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, je suis, 2017/05/16
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, Nicholas Jankowski, 2017/05/16
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, je suis, 2017/05/17
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, je suis, 2017/05/17
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, Nicholas Jankowski, 2017/05/17
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, Sergei Steshenko, 2017/05/17
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, je suis, 2017/05/17
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, je suis, 2017/05/17
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, je suis, 2017/05/17
- Re: I have modified firls.m to include all types of FIRs plus HT and diff, Sergei Steshenko, 2017/05/18