Help regarding "Attempted to access gainx(0.0101768); index must be a positive integer or logical." error.

1 view (last 30 days)
Hi,
I'm not particularly competent with MATLab but I'm trying to create some basic parametric filters and I'm running into an error which I'm struggling to determine. I've found people with the same error message online but I've not understood the advice they've been given because again, I'm new to this and have only very basic knowledge.
I'm getting this error:
"Attempted to access gainx(0.0101768); index must be a positive integer or logical."
...in regards to this:
%
Q = 3.5;
Fc = 500;
gaindB = -10.00;
Fbw = Fc/Q;
Fs = 44100;
R = 1 - (pi*Fbw)/Fs;
gainx = db2mag(gaindB);
r = 1 - gainx(1-R);
omegat = (2*pi*Fc)/Fs;
A simple explanation would be welcome if anyone knows, thanks.

Accepted Answer

Thorsten
Thorsten on 19 Dec 2014
Matlab needs * to denote multiplikation:
gainx = 1 - gainx*(1-R);
Does this solves your problem?

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!