Please write out script for this particular program: Write a Python program that
ID: 1275687 • Letter: P
Question
Please write out script for this particular program:
Write a Python program that will produce a plot of a Gaussian distribution for the following values: offset = 1. amplitude = 5 centroid = 10 standard deviation = 2 The equation of a generic Gaussian is: Your program should have the following properties: The x-axis should run from 0 to 20 The x-axis label should be "x [cm]" The y-axis should run from 0 to 6. The y-axis label should be "y = y(x) [Volts]" The function line should be black. A magenta dashed line should run from the x-axis at x=10 to the peak of the Gaussian function. There should be a plot legend that states what is being plotted. Show both the resulting image and the Python code you wrote to make it to receive full credit.Explanation / Answer
import numpy as np def makeGaussian(size, fwhm = 3, center=None): """ Make a square gaussian kernel. size is the length of a side of the square fwhm is full-width-half-maximum, which can be thought of as an effective radius. """ x = np.arange(0, size, 1, float) y = x[:,np.newaxis] if center is None: x0 = y0 = size // 2 else: x0 = center[0] y0 = center[1] return np.exp(-4*np.log(2) * ((x-x0)**2 + (y-y0)**2) / fwhm**2)