I am using the polyfit function and need to analyze the results but I am not sure quite how. My code so far is here:
function result = highest_coeff(x,y) x = [0 1 2]; y = [0 1 2]; coeffs = polyfit(x,y,2); result = coeffs; end
I need to analyze the results and find the first "value" that is greater than or equal to 0.1 or less than or equal to -0.1, then return the position of that value. For example when I run this code through the command window I get:
disp(highest_coeff(x,y)) -0.0000 1.0000 -0.0000
Here the first value is not >= 0.1 or <= -0.1, so the answer would be 2. Does anybody have any tips or solutions for this problem?
Best Answer