Using FInd Peak function but not getting required values

조회 수: 3 (최근 30일)
Ehtisham
Ehtisham 2024년 6월 14일
편집: Image Analyst 2024년 6월 14일
Using my custom find_peak function to locate the highest maximum and lowest minimum values in three Phases. But in last Phase I am not getting the required output even calling all phase with a same function. Secondly getting the 50% decay values that are negative. Kindly guide me what is wrong in my code. I am sharing my script and GUI file and screenshot

답변 (1개)

Nipun
Nipun 2024년 6월 14일
Hi Ehtisham,
I understand that you are having issues with the findpeaks function to locate the highest maximum and lowest minimum values in three phases, and you are encountering problems in the last phase and with 50% decay values. I recommend the following steps to get the expected results:
Highest Maximum and Lowest Minimum Values: Ensure you are correctly identifying peaks and troughs for each phase.
[~, locsMax] = findpeaks(signal, 'MinPeakHeight', threshold);
[~, locsMin] = findpeaks(-signal, 'MinPeakHeight', threshold);
maxValue = max(signal(locsMax));
minValue = min(signal(locsMin));
Handling Multiple Phases: Loop through each phase and apply the findpeaks function.
for phase = 1:numPhases
currentSignal = phases{phase}; % Assuming phases is a cell array of signals
[~, locsMax] = findpeaks(currentSignal, 'MinPeakHeight', threshold);
[~, locsMin] = findpeaks(-currentSignal, 'MinPeakHeight', threshold);
maxValue = max(currentSignal(locsMax));
minValue = min(currentSignal(locsMin));
disp(['Phase ', num2str(phase), ': Max = ', num2str(maxValue), ', Min = ', num2str(minValue)]);
end
50% Decay Values: Ensure you are computing the decay values correctly. If values are negative, adjust your computation accordingly.
halfDecayValue = 0.5 * maxValue; % Assuming maxValue is positive
decayLocs = find(signal <= halfDecayValue, 1);
if isempty(decayLocs)
disp('No decay point found');
else
decayValue = signal(decayLocs);
disp(['Decay value: ', num2str(decayValue)]);
end
Make sure to verify the phase-specific signals and their thresholds. This should help you identify why the last phase behaves differently.
Hope this helps.
Nipun
  댓글 수: 1
Ehtisham
Ehtisham 2024년 6월 14일
편집: Ehtisham 2024년 6월 14일
I added that but it required a signal toolbox that i do not have suggest me another solution.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by