How to create and plot a Gaussian Dist with specified parameters?

조회 수: 53(최근 30일)
Quant.Phys42
Quant.Phys42 2019년 12월 7일
답변: Sourav Bairagya 2019년 12월 10일
How would you create a Gaussian distribution of some form; G = A*exp -(x-mu)^2/2*sigma^2
where A, mu, and Sigma are specified and given and x are some frequency axis values and how would you plot this?
  댓글 수: 1
darova
darova 2019년 12월 8일
What have you tried? What about plot function?

댓글을 달려면 로그인하십시오.

답변(1개)

Sourav Bairagya
Sourav Bairagya 2019년 12월 10일
You can follow this example to create and plot a Gaussian distribution.
a = -100; b = 100;
x = a + (b-a) * rand(1, 500);
mu = (a + b)/2;
sigma = 30;
f = gaussian_distribution(x, mu, sigma);
plot(x,f,'.')
grid on
title('Gaussian Distribution Curve')
xlabel('X-axis')
ylabel('Gauss Distribution')
function f = gaussian_distribution(x, mu, sigma)
p = -(1/2) * ((x - mu)/sigma) .^ 2;
A = 1/(sigma * sqrt(2*pi));
f = A.*exp(p);
end

Community Treasure Hunt

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

Start Hunting!

Translated by