title: Matlab: Extracting error values from a fit
body: <p>I am using the following code to import a spreadsheet with two coloumns x = intensity and y = angle and to get the Gaussian curve fitting:</p>
  
  <pre><code>%% Initialize variables
  filename = ['E:\XRD\Enamel\MPS\3PC\Chiplots (starting from 0)\MPS_3Pcontrol_map_'  j '.dat'];
  startRow = 5;
  
  %% Format string for each line of text:
  formatSpec = '%14f%f%[^\n\r]';
  
  %% Open the text file.
  fileID = fopen(filename,'r');
  
  %% Read columns of data according to format string.
  dataArray = textscan(fileID, formatSpec, 'Delimiter', '', 'WhiteSpace', '', 'HeaderLines' ,startRow-1, 'ReturnOnError', false);
  
  %% Close the text file.
  fclose(fileID);
  
  %% Allocate imported array to column variable names
  plots.angle = dataArray{:, 1};
  plots.intensity = dataArray{:, 2};
  
  %% Fit: 'Gauss'.
  [xData, yData] = prepareCurveData(plots.(['angle' num2str(j)]), plots.(['intensity' num2str(j)]));
  % Set up fittype and options.
  ft = fittype( 'y0+a*exp(-((x-xa)/wa)^2) + b*exp(-((x-xb)/wb)^2) + c*exp(-((x-xc)/wc)^2) + d*exp(-((x-xd)/wd)^2) + e*exp(-((x-xe)/we)^2) + f*exp(-((x-xf)/wf)^2)', 'independent', 'x', 'dependent', 'y' );
  opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
  opts.Display = 'Off';
  opts.Lower = [0 0 0 0 0 0 0.1 0.1 0.1 0.1 0.1 0.1 -Inf -Inf -Inf -Inf -Inf -Inf -Inf];
  opts.StartPoint = [1400 1400 1000 1200 1200 1000 25 25 25 25 25 25 75 125 170 250 275 325 0.5];
  opts.Upper = [inf inf inf inf inf inf 50 50 50 50 50 50 inf inf inf inf inf inf Inf];
  % Fit model to data.
  [fitresult, gof] = fit( xData, yData, ft, opts );
  </code></pre>
  
  <p>I can get the values of the coefficients using: <code>cfit(fitresult)</code> to get the following:</p>
  
  <p><img src="https://i.stack.imgur.com/p14EH.jpg" alt="enter image description here"></p>
  
  <p>From the above I can extract the coefficients values using <code>coeffvalues(cfit(fitresult))</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/B3BmG.jpg" alt="enter image description here"></p>
  
  <p>The problem is I cant get the values highlighted in yellow, which I need to calculate the standard error using the equation (standard error = standard deviation/square root of n)</p>
  
  <p>Can I extract the values highlighted in yellow in order to calculate the standard error?</p>