[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes
From: |
John Donoghue |
Subject: |
[Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes |
Date: |
Fri, 19 May 2023 13:48:02 -0400 (EDT) |
Follow-up Comment #5, patch #10351 (project octave):
I applied the patch, but there is still an error in one of the demos:
demo firpm 8
firpm example 8:
cic = @(f) (sin (pi*(f+eps*!f)/2)./sin (pi*(f+eps*!f)/2/10)/10).^4;
if compare_versions(OCTAVE_VERSION, '6', '<')
eval('b = firpm (30, [0 .5 .7 1], @(n,f,g) deal (a=(g<=f(2))./cic (g),
1./(a+!a)));')
else
function [ag wg] = resp (n,f,g) ag = (g<=f(2))./cic (g); wg = 1./(ag+!ag);
endfunction
b = firpm (30, [0 .5 .7 1], @resp);
endif
clf; [h f]=freqz (b); plot (f/=pi, 20*log10 (abs (h)))
grid on; axis ([0 1 -60 6]); set (gca, 'xtick', [0:.1:1])
title (sprintf ('firpm type-I CIC-compensation filter (order=%i)', length (b)
- 1));
ylabel ('Magnitude response (dB)'); xlabel ('Frequency (normalized)')
axes ('position', [2 3 4 3]/10)
plot (f, 20*log10 (abs (h).*cic (f))); axis ([0 .55 -.04 .04]); grid on
title ('Compensated filter response')
%--------------------------------------------------
% Figure shows transfer details of CIC-compensation
% filter design.
firpm example 8: failed
resp: function called with too many inputs
I guessing it should be:
diff -r 5ca91861a7c9 src/firpm.cc
--- a/src/firpm.cc Fri May 19 13:37:23 2023 -0400
+++ b/src/firpm.cc Fri May 19 13:47:00 2023 -0400
@@ -1029,9 +1029,9 @@
%! cic = @(f) (sin (pi*(f+eps*!f)/2)./sin (pi*(f+eps*!f)/2/10)/10).^4;
%!
%! if compare_versions(OCTAVE_VERSION, '6', '<')
-%! eval('b = firpm (30, [0 .5 .7 1], @(n,f,g) deal (a=(g<=f(2))./cic (g),
1./(a+!a)));')
+%! eval('b = firpm (30, [0 .5 .7 1], @(n,f,g, w) deal (a=(g<=f(2))./cic
(g), 1./(a+!a)));')
%! else
-%! function [ag wg] = resp (n,f,g) ag = (g<=f(2))./cic (g); wg =
1./(ag+!ag); endfunction
+%! function [ag wg] = resp (n,f,g,w) ag = (g<=f(2))./cic (g); wg =
1./(ag+!ag); endfunction
%! b = firpm (30, [0 .5 .7 1], @resp);
%! endif
%!
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/patch/?10351>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, Rob Sykes, 2023/05/18
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, John Donoghue, 2023/05/19
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, John Donoghue, 2023/05/19
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, Rob Sykes, 2023/05/19
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, Rob Sykes, 2023/05/19
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes,
John Donoghue <=
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, Rob Sykes, 2023/05/20
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, John Donoghue, 2023/05/20
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, John Donoghue, 2023/05/20
- [Octave-patch-tracker] [patch #10351] (signal) firpm portability fixes, Dmitri A. Sergatskov, 2023/05/20