Code covered by the BSD License  

Highlights from
Best Fit Legend

image thumbnail

Best Fit Legend

by

 

the best tool for signal processing, of a section of your data.

Equation(polyCoeff, x, y)
function str = Equation(polyCoeff, x, y)
strcoefficient = {};str = '';
degree = length(polyCoeff)-1;
for n = 1:length(polyCoeff)
    coeff = polyCoeff(n);
    if coeff>=0
        strcoef = ['+' num2str(coeff)];
    else
        strcoef = num2str(coeff);
    end
    if degree~=0
        %['$$2.95 y = 0.874 \cdot{y}^2 $$']
        strcoefficient{n} = [' ' strcoef, ' \cdot {X}^{' int2str(degree) '} '];
    else
        strcoefficient{n} = [' ' strcoef];
    end
    degree = degree -1;
end
str = '';
for n = length(strcoefficient):-1:1
    str = strcat(strcoefficient{n},str);
end
str = ['   Y = ' str];
str = text('position', [x y],'FontSize', 13, 'interpreter', 'latex',...
    'string', ['$$' str '$$'], 'color', 'red',...
    'fontweight', ' bold', 'visible', 'off');

%NB: Visibilty of the text  object is set to off.

Contact us