function [fitresult, gof] = createFit(combined_power_names, combined_power_rss) %CREATEFIT(COMBINED_POWER_NAMES,COMBINED_POWER_RSS) % Create a fit. % % Data for 'Energy Model' fit: % X Input : combined_power_names % Y Output: combined_power_rss % Output: % fitresult : a fit object representing the fit. % gof : structure with goodness-of fit info. % % See also FIT, CFIT, SFIT. % Auto-generated by MATLAB on 15-Oct-2015 22:10:26 %% Fit: 'Energy Model'. [xData, yData] = prepareCurveData( combined_power_names, combined_power_rss ); % Set up fittype and options. ft = fittype( 'poly3' ); % Fit model to data. [fitresult, gof] = fit( xData, yData, ft, 'Normalize', 'on' ); % Plot fit with data. figure( 'Name', 'Energy Model' ); h = plot( fitresult, xData, yData ); legend( h, 'combined_power_rss vs. combined_power_names', 'Energy Model', 'Location', 'NorthEast' ); % Label axes xlabel combined_power_names ylabel combined_power_rss grid on