% % Do a fit for sensor calibrations % function [coeff, nval, error]=fit(freq,height,order) function [coeff, nval, error]=fit(freq,height,order); coeff=polyfit(freq,height,order) nval=polyval(coeff, freq); error=sum((height-nval).*(height-nval)) fprintf('\nHit any key to continue...') pause plot(freq,height,'o',freq,nval,'-') xlabel('Freq: hz') ylabel('Height')