meansquarederrorline; % generate data p0 = [2.0, 1.0]; pest = lsqcurvefit(@powerLaw, p0, x, y) hold on; % generate x-values for plottig the fit: xx = min(x):0.01:max(x); yy = powerLaw(xx, pest); plot(xx, yy); % plot fit plot(x, y, 'o'); % plot original data xlabel('Size [m]'); ylabel('Weight [kg]'); legend('fit', 'data', 'location', 'northwest');