How would I find the first twelve local maximum (peak) values for y and the corresponding times using a script?
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 Datady = 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