MATLAB: How to get the error value when fitting a gaussin curve to a data signal processing guassian uniform histfit normfit I have the following data fitting curve: And i'd like to compute the error associated to this fitting, the var error! If some one knows how to do it please help me. Thanks Best Answer To do the plot and get the data to analyse the error of the fit, this works:x = 0.25*randn(1000,1)+1; % Create Datah = histfit(x,50);histdata = get(h(1),'XData'); % Get Histogram Dataredcurve = get(h(2),'YData'); % Get Fit Datahistctrs = mean(histdata); % Mean Of Bin Edgesredcurve2 = mean(reshape(redcurve, 2, [])); % Mean Of Bin Edges Fitfit_err = histctrs - redcurve2; % ErrorSSE = sum(fit_err.^2); % Sum-Squared ErrorMSE = mean(fit_err.^2); % Mean-Squared-ErrorRMSE = sqrt(MSE); % Root-Mean-Squared-ErrorYour data actually seem to me to be lognormally distributed, so consider using the 'lognormal' distribution option. Related SolutionsMATLAB: How to fit a specific distribution to data Assuming your data samples are stored in 1-by-N (or N-by-1) array x, the following code can fit log-normal distribution to the data.pd = fitdist(x,'Lognormal')But, regarding you question, what do you mean by "fit my data to a classic lognormal distribution with mu=1 and sigma=1.1" ? MATLAB: Curve Fitting on Histogram Hi Ahmed,if I usedata = rand(1e6,1);it works flawlessly, but if I usedata = 2*rand(1e6,1);I get the same error. As the error suggests, the function only works on Data Ranges [0,1]. Related QuestionHow to compute the standard deviation of a Gaussian fit generated with the Curve Fitting AppNormal distribution problem using histfitHow can I put the histfit function in terms of probability
Best Answer