Say I have polynomial coefficients saved as
and I wish to call polyval on said coefficients, except the nomenclature is made up of different variables as GXY where X equals group and Y equals day
I can run
sprintf('G%g%g', group, day);
but when I run it with polyval I get an error
polyval(sprintf('G%g%g', group, day), 1);
Error using filter
Invalid data type. Input arrays must be numeric or logical.
Error in polyval (line 56)
y = filter(1,[1 -x],p);
I'm not sure how to provide an appropriate input for polyval. I have tried num2str and some other ideas. The reason I am doing this is because I have 6 polynomials to loop through to verify a value is out of a certain range before recording a final value.