How to create and plot a Gaussian Dist with specified parameters?
49 views (last 30 days)
Show older comments
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?
Answers (1)
Sourav Bairagya
on 10 Dec 2019
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
0 Comments
See Also
Categories
Find more on Descriptive Statistics and Visualization 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!