Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a MATLAB function script file to calculate the coordinates ( x , y ) of the peak points in the range of x values

Create a MATLAB function script file to calculate the coordinates
(x, y) of the peak points in the range of x values for the function y = x^21.
Define the function with the following (function definition line):
function [yp, xp]= Peak(xStart, xEnd)
where xStart is the starting value of x in the range to find the peak points,
and xEnd is the ending value of x in the range to find the peak points.
yp is the y-coordinate of the peak at the end of the signal, and
xp is the x-coordinate of the peak at the end of the signal.
Test by calling the Peak function in the Command Window with xStart =-4 and xEnd =4:
[yp, xp]= Peak(-4,4);
The expected result is yp =-1 and xp =0.
Suggestions:
- Use the command maxPeak = findpeaks(y) to find the maximum peak points of the signal.
- Use the command minPeak =-findpeaks(-y) to find the minimum peak points of the signal.
- Use the command xp = double.empty(1,0) to initialize the output xp as an empty row vector.
- Use the command yp = double.empty(1,0) to initialize the output yp as an empty row vector.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

a valuing of personal and psychological privacy;

Answered: 1 week ago