How would I find the first twelve local maximum (peak) values for y and the corresponding times using a script?

Technical Source
2 min readFeb 22, 2021

--

How would I find the first twelve local maximum (peak) values for y and the corresponding times (t) using a script?

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

If you don’t have the Signal Processing Toolbox, and since you have a clean, noise-free signal, this works:

x = linspace(0,20,250);             % Create Data
y = exp(-0.25*x) .* sin(2.5*pi*x); % Create Data
dy = gradient(x,y); % Derivative: dy/dx
zx = dy.*circshift(dy, [0 -1]); % Zero-Crossings Of Derivative
pkix = find(zx<0); % Zero-Crossing Indices
pkix = pkix(y(pkix)>0); % Indices Of Peaks

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet