Hello everyone,
I am facing troubles trying to extract data from a gaussian curve. I can extract the information I need from my raw data (max y, corresponding x value, and FWHM) but I am not sure how to get a gaussian fit and extract the same data from it.
I am able to create a gaussian using fit
f1=fit(Mwavelength(:,t),MPL(:,t),'gauss2');
but cannot get any information out of my gaussian curve, only plot it since the variable f1 comes out to be a 1 x 1 cfit.
Any help would be greatly appreciated!
N=(196x7 string) % Each entry corresponds to the title of a text file, which contains two columns of data.
for t = 1:7 for k = 1:196 spectra = importdata(N(k,t)); % Import the data from the .txt file
%I want to get a gaussian fit of the spectra here, and then gather the wavelength (x axis values) and PL (yaxis values) from that.
wavelength(:,k) = spectra(:,1); % my x-axis
PL(:,k) = spectra(:,2); % my y-axis
[M,I] = max(PL(:,k)); X = wavelength(I,k); Peaks(k,t) = M; % Creates matrix 'Peaks' with the max peak for all pixels in the 14x14 data collection area
Position(k,t) = X; % Creates matrix 'Position' with the corresponding x value at the peak.
endMwavelength(:,t) = mean(wavelength,2); MPL(:,t) = mean(PL,2);end
Best Answer