Question: USE MATLAB Write a script program that addresses the following: ( a ) Assign the data for distance and amplitude to column vector variables x

USE MATLAB
Write a script program that addresses the following:
(a) Assign the data for distance and amplitude to column vector variables x and y, respectively.
(b) Take the natural logarithm of the amplitude data and assign to the variable yp.
(c) Assuming a linear fit model, use the polyfit command on the yp vs. x data to find the best-fit values m and b in yp = mx+ b. Compute the predicted values for this model and assign to variable yp_linear.
(i) Use fprintf to display these values with a message that they were obtained using polyfit.
(d) Create a plot of the linearized amplitude yp vs. distance data x (as blue circle points). In the same figure, plot the predicted amplitude yp_linear vs. distance data x (as a dashed red line).
(i) Label the horizontal axis as Distance and vertical axis as Natural Log Amplitude.
(ii) Add a title to the figure as Linearized Sound Amplitude Plot.
(iii)Add a legend to the figure with labels Linearized data and Linear fit, respectively.
(e) Assuming an exponential fit model, use the found values m and b in part (d) to determine the values a and c in y = ae^(-cx). Compute the predicted values for this model and assign to variable yp_exp.
(i) Use fprintf to display these values with a message that they were obtained from m and b.
(f) Create a second plot of the original amplitude y vs. distance data x (as blue asterisk points). In the same figure, plot the predicted amplitude yp_exp vs. distance data x (as a solid red line).
(i) Label the horizontal axis as Distance and vertical axis as Amplitude.
(ii) Add a title to the figure as Sound Amplitude Plot.
(iii)Add a legend to the figure with labels Original data and Exponential fit, respectively.
(g) Use the exponential fit model to predict the sound amplitude at a distance of x=5.
(i) Use fprintf to display a message with the amplitude value predicted at this distance
USE MATLAB Write a script program that addresses

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!