Fit Multiple gaussian curve on data with flat tops
2 件のコメント
回答 (2 件)
Hi Amit,
You asked, How to fit double gaussian curve for this data set which is flat at some domains?
To answer your question, use the fit function along with a custom equation that represents the double Gaussian curve. I can provide a basic example to get you started:
I will generate example data with two Gaussian peaks and some noise.
>> % Generate example data x = linspace(0, 10, 100); y = 2*exp(-(x-3).^2) + 1.5*exp(-(x-7).^2) + 0.5*randn(size(x));
Use the fit function with the gauss2 model to fit the double Gaussian curve to the data.
% Fit a double Gaussian curve f = fit(x', y', 'gauss2');
Finally, plot the original data points along with the fitted curve for visualization.
% Plot the data and the fitted curve plot(x, y, 'o') hold on plot(f, x, y) legend('Data', 'Fitted Curve')
For more information on fit function, please refer to
https://www.mathworks.com/help/curvefit/fit.html
Hope this will help resolve your problem.
0 件のコメント
0 件のコメント
参考
カテゴリ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!