ScaleValues property error in designing a filter with designParamEQ and dsp.BiquadFilter

1 view (last 30 days)
Hello everyone,
I'm trying to design a filter with dsp.BiquadFilter and designParamEQ in MATLAB R2020a. I get the following error message:
Error using BiquadFilter/BiquadFilter.setParameters
The ScaleValues property value must be either a scalar or a vector of length one greater than the number of sections.
I'm designing twelve parametric equalizers for a certain frequency (FreqVector) and amplitude (GVector), which I want to cascade and apply to a stereo signal (two channels). Here's my current code:
rma = zeros(3,12);
rmb = zeros(2,12);
for ii=1:12
[rma(:,ii), rmb(:,ii)] = designParamEQ(N1,GVector(ii,:),FreqVector(ii,:),BW);
end
BiquadFilter1 = dsp.BiquadFilter('SOSMatrix',[rma(1).',[1,rmb(1).']]);
BiquadFilter2 = dsp.BiquadFilter('SOSMatrix',[rma(2).',[1,rmb(2).']]);
% ...
[AllBiquads] = dsp.FilterCascade(BiquadFilter1, BiquadFilter2, BiquadFilter3, BiquadFilter4, BiquadFilter5, BiquadFilter6, BiquadFilter7, BiquadFilter8, BiquadFilter9, BiquadFilter10, BiquadFilter11, BiquadFilter12);
for ii=1:2
y(ii,:) = AllBiquads(in(ii,:));
end
Here's the complete error message that I get:
Error using BiquadFilter/BiquadFilter.setParameters
The ScaleValues property value must be either a scalar or a vector of length one greater than the number of sections.
Error in dsp.BiquadFilter/setParameters
Error in dsp.FilterCascade/getNumInputsImpl (line 614)
n = getNumInputs(obj.Stage1);
Error in prototype_25012021 (line 207)
y(ii,:) = AllBiquads(in(ii)); - Show complete stack trace
What's wrong here? Any ideas how to solve my problem?

Accepted Answer

jibrahim
jibrahim on 3 Mar 2021
Hi Patrick,
I can't run your code because certain variables are missing (N1, GVector, in, out, etc), but in R2020a, this code should give you a dsp.BiquadFilter:
Fs = 48e3;
N = [2, 4];
G = [6, -4];
Noct = [1.5, 1];
Q = sqrt(2.^Noct)./(2.^Noct-1); % Q factors
Wo = [100 5000]/(Fs/2);
BW = Wo./Q;
[B,A] = designParamEQ(N,G,Wo,BW,'Orientation','row');
bqd = dsp.BiquadFilter('SOSMatrix',[B,A]);
bqd(1) % works
f = dsp.FilterCascade(bqd,bqd);
f(1) % works
  1 Comment
Patrick Boettcher
Patrick Boettcher on 4 Mar 2021
Thanks! I found the mistake myself, I was adressed the wrong lines, because I have a vector matrix. It has to be:
BiquadFilter1 = dsp.BiquadFilter('SOSMatrix',[rma(:,1).',[1,rmb(:,1).']]);
BiquadFilter2 = dsp.BiquadFilter('SOSMatrix',[rma(:,2).',[1,rmb(:,2).']]);

Sign in to comment.

More Answers (0)

Categories

Find more on Measurements and Spatial Audio in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!