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
  • In Python - For these functions do not use built functions such as hex() and bin()...

    In Python - For these functions do not use built functions such as hex() and bin() to solve the problem intToBinary ( int ) : String • takes a int as parameter and returns 16 bit string representation of that integer in binary. • Your function only needs to work for integers in the range 0 - 65535 • Example: intToBinary(213) – returns “0000000011010101”

  • In Python, For these functions do not use built functions such as hex() and bin() to...

    In Python, For these functions do not use built functions such as hex() and bin() to solve the problem. binaryToInt ( String ) : int • Takes a string of 16 0s and 1s and returns an integer corresponding integer in the range 0-65535

  • Python Homework: - NOTE - Must not use built-in functions (other than the range() function), slice...

    Python Homework: - NOTE - Must not use built-in functions (other than the range() function), slice expressions, list methods (other than the append() method) or string methods in your solution. Write a function called reverse(my_list, number=-1) that takes a list and a number as parameters. The function returns a copy of the list with the first number of items reversed. Conditions: - The number parameter must be a default argument. -      If the default argument for number is given in...

  • Write a function in Python that solves the linear system ??=? using Gaussian Elimination, taking ?,?...

    Write a function in Python that solves the linear system ??=? using Gaussian Elimination, taking ?,? as input. The function should have two phases: the elimination phase, and the back substitution phase. You can use numpy library.

  • Python: using a stack, implement a function that takes in an arithmetic expression, and evaluates it,...

    Python: using a stack, implement a function that takes in an arithmetic expression, and evaluates it, supported operations are + and -, which have same precedence. Note: one way to do it is to scan the entire expr pushing numbers onto val-stack and operations on op-stack until tokens in expr are done. Then, use a loop to pop two numbers from val-stack and one operation from op-stack, evaluate, and push results back to val-stack, until op-stack is empty.

  • matlab The error function is a mathematical function that frequently arises in probability and statistics. It also c...

    matlab The error function is a mathematical function that frequently arises in probability and statistics. It also can show up in the solution to some partial differential equations, particularly those arising in heat and mass transfer applications. The error function is defined as 2 e-t dt picture attached This function is actually built-in to MATLAB as the command erf, and here we'll use that function to compute a "true value" with which we can compare results of two interpolation approaches....

  • Write a base 64 decode in python?Please comment and DO NOT USE BUILT IN DECODE FUNCTION.

    Write a base 64 decode in python?Please comment and DO NOT USE BUILT IN DECODE FUNCTION.

  • Resampling: Do not use any in-built functions from opencv and numpy. In general, you can use...

    Resampling: Do not use any in-built functions from opencv and numpy. In general, you can use function from math library. Functions allowed for this part are: np.array(), np.matrix(), np.zeros(), np.ones(), cv2.imread(), cv2.namedWindow(), cv2.waitKey(). Write code for zooming and shrinking an image using the nearest neighbor and bilinear interpolation. The input to your program is: (i) image, (ii) transformation parameters, and (iii) interpolation method. (Can I get more of an explanation and puesdocode of how you use nearest neighbor and bilinear...

  • ON PYTHON: ''' Design the functions described below. RECALL: With functions that do not return a...

    ON PYTHON: ''' Design the functions described below. RECALL: With functions that do not return a value and print a result to the console, to test you must call the function, run it and visually inspect the result for correctness. With functions that return a value, use the print_test function to provide feedback of the test results at the command line. The print_test function is implemented for you at the bottom of this file. RECALL: floating point arithmetic can lose...

  • The probability density function (pdf) of a Gaussian random variable is: where μ s the mean...

    The probability density function (pdf) of a Gaussian random variable is: where μ s the mean of the random va nable, and σ is the standard deviation . (1) Please plot the pdf of a Gaussian random variable (the height of an average person in Miami valley) in Matlab, if we know the mean is 5 feet 9 inches, and the standard deviation is 3 inches (2) Please generate a large number of instances of such a Gaussian random variable...

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