how to draw gaussian curve

16 views (last 30 days)
GOWTHAMI
GOWTHAMI on 2 Mar 2023
Answered: Ayush on 5 Feb 2024
i have the value for FULL WIDTH AND HALF MAXIMUM and WAVELEGTH VALUE. using these things how can i plot the curve

Answers (1)

Ayush
Ayush on 5 Feb 2024
This answer was flagged by Aidan Connaughton
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;

Categories

Find more on Fit Postprocessing in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!