Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function, called multGauss, to compute the sum of multiple Gaussian (normal) profiles. See the figure here to illustrate what Gaussians of different locations,
- Write a function, called multGauss, to compute the sum of multiple Gaussian (normal) profiles. See the figure here to illustrate what Gaussians of different locations, amplitudes and widths (standard deviations) look like. The function should itself call the function gaussmf (built-in matlab function) to do the basic calculation, returning only the sum (i.e., add together the individual Gaussian profiles). The function multGauss that you write should be able to handle any number of requested Gaussians (say 2, 4, 10, whatever). The easiest way to determine the number of requested Gaussians might be from the number of rows in an input (input to the function) matrix, beta, each of which contains the parameters of each component Gaussian. Include error checking to ensure that the input parameter matrix has three columns, returning an error if not. To clarify, the inputs to multGauss should be (i) an input matrix with three columns (see help on gaussmf; the third parameter is simply the amplitude (default is 1) of the Gaussian) for the parameters and at least one row (each row being an individual Gaussian; (ii) a vector x specifying the domain for the calculations. The output from multGauss is a vector that gives the sum of the Gaussians at each location x in the domain.
- Write an m-file called mygauss.m that defines the input variables, issues a call to multGauss and plots the result. Let the domain range from 0 to 20. Let there be four Gaussians. The amplitudes are to be 0.1, 0.5, 1, and 2. The standard deviations (sigma) are to be 0.5, 1, 2 and 3. The positions are to be 2, 4, 6, and 8.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started