curve fit for 4 variables, error 'not enough input arguments'

3 views (last 30 days)
function [fitresult, gof] = createFit(CO2NonWorkZone, diveIRI, CO2WorkZone,diffeIRI)
[xData, yData, zData, gData] = prepareData( CO2NonWorkZone, diveIRI, CO2WorkZone, diffeIRI );
ft = fittype( 'a + c*x*g*exp(w*y)', 'independent', {'x', 'y','g'}, 'dependent', 'z' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.371420685802539 0.0606895470210004 0.376869074010979];
% Fit model to data.
[fitresult, gof] = fit( [xData, yData, gData], zData, ft, opts );
figure( 'Name', 'untitled fit 1' );
h = plot( fitresult, [xData, yData, gData], zData );
legend( h, 'untitled fit 1', 'CO2WorkZone vs. CO2NonWorkZone, diveIRI, diffeIRI', 'Location', 'NorthEast' );
xlabel( 'CO2NonWorkZone' );
ylabel( 'diveIRI' );
zlabel( 'CO2WorkZone' );
glabel( 'diffeIRI' );
grid on
  1 Comment
Geoff Hayes
Geoff Hayes on 5 Jul 2015
Wu - please include the full error message (all text that is in red) so that we can get an idea of which line is generating the error message. Is it the call to createFit? Also, is this function the one from the File Exchange at here?

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!