Question

Directly using mathematical expression, DO NOT USE the built-in Python functions, evaluate the Gaussian function forμ...

Directly using mathematical expression, DO NOT USE the built-in Python functions, evaluate the Gaussian function forμ = 5, σ = 0.1. Make sure you plot your results

Now plot the Gaussian function using the built-in Python functions.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

File Edit Selection View Go Run Terminal Help • Rough.py - Visual Stu one.py rough.java Rough.py. 1 C Rough.c Java Overview G

from matplotlib import pyplot as mp

import numpy as np

# function to calculate gaussian function


def gaussian(x, mu, sig):

    return 1./(np.sqrt(2.*np.pi)*sig)*np.exp(-np.power((x - mu)/sig, 2.)/2)

#mu = 5

#sig = 0.1


# plotting graph

x_values = np.linspace(4.5, 5.5, 1200)

for mu, sig in [(5, 0.1)]:

    mp.plot(x_values, gaussian(x_values, mu, sig))

mp.show()

4.0 3.5 3.0 -- 2.5 2.0 1.5 1.0 0.5 0.0 4.6 4.8 5.0 5.2 5.4

PLEASE LIKE IT RAISE YOUR THUMBS UP
IF YOU ARE HAVING ANY DOUBT FEEL FREE TO ASK IN COMMENT SECTION

Add a comment
Know the answer?
Add Answer to:
Directly using mathematical expression, DO NOT USE the built-in Python functions, evaluate the Gaussian function forμ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT