Hello, I have strange problem cause, on my computer fit function just desn't work. I thought that's my fault but code that I write compile properly in matlab online but does not in custom version, what's more I installed the curve fitting tool and ask for generating code matalb can;t run that program which was generated by it. Here is code, i would be gratful for pasting it into your matalb and say do you also get an error. My error is:
Error in createFit2 (line 18)
[xData, yData] = prepareCurveData( x, y );
Code generted by matlab:
function [fitresult, gof] = createFit2(x, y)
%CREATEFIT2(X,Y)
% Create a fit.
%
% Data for 'Dioda 1' fit:
% X Input : x
% Y Output: y
% 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 11-Nov-2020 23:05:36
%% Fit: 'Dioda 1'.
[xData, yData] = prepareCurveData( x, y );
% Set up fittype and options.
ft = fittype( 'exp1' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Normalize = 'on';
opts.StartPoint = [117.535994401642 3.22582417353711];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( 'Name', 'Dioda 1' );
plot( fitresult, xData, yData );
% Label axes
xlabel( 'x', 'Interpreter', 'none' );
ylabel( 'y', 'Interpreter', 'none' );
grid on