how to draw gaussian curve

80 次查看(过去 30 天)
GOWTHAMI
GOWTHAMI 2023-3-2
回答: Ayush 2024-2-5
i have the value for FULL WIDTH AND HALF MAXIMUM and WAVELEGTH VALUE. using these things how can i plot the curve

回答(1 个)

Ayush
Ayush 2024-2-5
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;

类别

Help CenterFile Exchange 中查找有关 Parametric Spectral Estimation 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by