How do I write a matlab function for the following expression?

2 Ansichten (letzte 30 Tage)
Giuseppe Maria Perrucci
Giuseppe Maria Perrucci am 26 Okt. 2021
Beantwortet: Pranjal Kaura am 29 Okt. 2021
Evaluate f (x = 1) when μ = 0, σ = 2.

Antworten (1)

Pranjal Kaura
Pranjal Kaura am 29 Okt. 2021
Hey
Here is a code snippet for the required function
function f_x = PDF(x, u, sigma)
f_x = exp(-(x - u).^2/(2*sigma.^2))/(sigma*sqrt(2*pi));
end
You can also use the 'normpdf' function.
Hope this helps!

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!