How to plot the probability density function using vectorisation.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Giuseppe
el 19 de Mzo. de 2014
Comentada: Giuseppe
el 19 de Mzo. de 2014
This is the function we have been given.
f(x) = 1/sqrt(2*pi*σ^2) * exp(-(x-μ)^2)/(2*σ^2)
We have been told to solve for this where:
μ = 0
σ = [1 2 3 4 5]
x = linspace(-10,10,200)
It needs to be plotted evaluating the function for all the elements of σ and plotted on the same graph. I have tried numerous times and cant seem to get a plot. I no how to plot i just cant seem to plot this function.
NOTE: We cant use the built in probability density function or a for loop just using vectorization.
0 comentarios
Respuesta aceptada
Mischa Kim
el 19 de Mzo. de 2014
Guiseppe, something like
mu = 0;
si = [1 2 3 4 5];
x = linspace(-10,10,200);
[X,SI] = meshgrid(x,si);
f = 1./sqrt(2*pi*power(SI,2)) .* exp(-power((X-mu),2))./(2*power(SI,2));
surf(X,SI,f)
xlabel('x')
ylabel('{\sigma}')
box;
Más respuestas (0)
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!