How to specify which version of a function to use?
Mostrar comentarios más antiguos
I am trying to run the grpdelay.m function which calculates the group delay in samples of a filter given certain inputs.
There are two similar input methods for the function. It is calling the wrong one for me but I'm not sure how to tell it to call the right one.
Here are the two similar input methods:
## [g, f] = grpdelay(b,a,n,Fs)
## evaluates the group delay at n frequencies between 0 and Fs/2.
##
## [g, f] = grpdelay(b,a,f,Fs)
## evaluates the group delay at frequencies f (in Hz).
I would like the second option. Ie. I want to specify a frequency "f" and calculate the group delay at that frequency. However, it keeps running the first option instead, giving me the group delay at "n" frequencies.
How do I force it to take the third input variable as "f" rather than "n"?
Here is my sample code:
g = 0.903228;
a1 = -1.88142;
a2 = 0.903228;
B1 = -2.08299;
B2 = 1.10714;
b = g * [1, B1, B2];
a = [1,a1,a2];
f = 82.2;
Fs = 44100;
[g, f] = grpdelay(b,a,f,Fs);
[g, f]
Rather than outputing just one group delay at 82.2 Hz, it is outputting 82 different group delays across the frequency spectrum.
What am I doing wrong? Thanks.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!