how to plot a gaussian 1D in matlab
Mostrar comentarios más antiguos
for k = 1 : K
ax = linspace(min_x,max_x,100);
y = my_gaussian(x,means,vars);
plot(ax,y);
end
Respuesta aceptada
Más respuestas (2)
You can use Matlab function to construct Gaussian function :
x = 0:0.1:10;
y = gaussmf(x,[2 5]);
plot(x,y)

4 comentarios
Gadadhar Sahoo
el 1 de Dic. de 2017
Editada: Gadadhar Sahoo
el 1 de Dic. de 2017
M
el 1 de Dic. de 2017
Did you read the documentation ? Those are the second parameter you give to the function gaussmf(x,[sigma,mean]) .
Gadadhar Sahoo
el 1 de Dic. de 2017
Chad MacDonald
el 2 de Ag. de 2023
Editada: Chad MacDonald
el 12 de Nov. de 2024
Do not use the gaussmf function from Fuzzy Logic Toolbox to compute a Gaussian distribution. This function evaluates a Gaussian membership function for a fuzzy logic system, which is not the same thing as a Gaussian distribution. For more information on Gaussian probability distributions, see Normal Distribution.
Chad MacDonald
el 12 de Nov. de 2024
Editada: Chad MacDonald
el 12 de Nov. de 2024
If you have Statistics and Machine Learning Toolbox, you can compute a Gaussian probability distributon using the normpdf function. For example, the following code computes and plots a normal distribution with a mean of 5 and a standard deviation of 1.
x = 0:0.1:10;
mu = 5;
sigma = 1;
y = normpdf(x,mu,sigma);
plot(x,y)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




