how to draw gaussian curve
81 views (last 30 days)
Show older comments
i have the value for FULL WIDTH AND HALF MAXIMUM and WAVELEGTH VALUE. using these things how can i plot the curve
0 Comments
Answers (1)
Ayush
on 5 Feb 2024
Hi,
It seems you are trying to make use of FULL WIDTH AND HALF MAXIMUM (FWHM) and wavelength values to obtain a Gaussian curve.
You can make use of the relation between "sigma" and "FWHM", which is given as:
sigma = FWHM / (2 * sqrt(2 * log(2)));
The sigma obtained can be used in the Gaussian curve formula along with the wavelength values. Refer to an example code below for a better understanding:
% Define the FWHM and central wavelength
FWHM = 10; % Replace with your actual FWHM value
central_wavelength = 500; % Replace with your actual wavelength value
% Calculate the standard deviation (sigma) from the FWHM
% The relationship between FWHM and sigma for a Gaussian function is:
% FWHM = 2 * sqrt(2 * log(2)) * sigma
sigma = FWHM / (2 * sqrt(2 * log(2)));
% Create a range of wavelength values around the central wavelength
wavelengths = linspace(central_wavelength - 3*FWHM, central_wavelength + 3*FWHM, 1000); % This is an example range and can be changed as per the requirements
% Calculate the Gaussian function values for those wavelengths
gaussian_values = (1 / (sigma * sqrt(2*pi))) * exp(-((wavelengths - central_wavelength).^2) / (2 * sigma^2));
% Plot the Gaussian curve
plot(wavelengths, gaussian_values);
title('Gaussian Curve');
xlabel('Wavelength');
ylabel('Intensity');
grid on;
0 Comments
See Also
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!