## Finding the spectrums of three segments of a signal without using the 'fiindpeaks' function?

Hannah Oduntan

### Hannah Oduntan (view profile)

さんによって質問されました 2019 年 1 月 9 日

### TADA (view profile)

さんによって コメントされました 2019 年 1 月 11 日
How can I find the spectrums of the segment of the signal before the major peak, after the major peak and othe spectrum of the major peak all separately? Doing all this without using the findpeaks function. The signal link has been attached.

#### 0 件のコメント

サインイン to comment.

## 2 件の回答

2019 年 1 月 9 日

### TADA (view profile)

2019 年 1 月 9 日

There can be quite a few approaches to do this
A simple yet effective method would be to analyze the slope, you can start by finding the peak location by finding the maximum signal value (granted this is a single peak signal)
then you can detect the edges of the peak by tracing changes to the slope from positive to negative
If the signal may contain more than one peak, you can use the maximal changes in the slope to locate the peak locations as well.
you can use that as a starting point:
x = 1:length(Signal);
y = Signal;
peakIdx = find(y == max(y));
dy = diff(y);
peakStart = find(dy(1:peakIdx-1) < 0, 1, 'last');
peakEnd = find(dy(peakIdx:end) > 0, 1, 'first') + peakIdx;
plot(x(1:peakStart), y(1:peakStart), '-b',...
x(peakStart:peakEnd), y(peakStart:peakEnd), '-g', ...
x(peakEnd:end), y(peakEnd:end), '-r');

### TADA (view profile)

2019 年 1 月 10 日
Do you mean frequency spectrum?
Hannah Oduntan

### Hannah Oduntan (view profile)

2019 年 1 月 11 日
Yes, the frequency spectrum.

### TADA (view profile)

2019 年 1 月 11 日

サインイン to comment.

2019 年 1 月 9 日

### Sean de Wolski (view profile)

2019 年 1 月 11 日

doc pwelch
doc islocalmax
doc islocalmin

#### 0 件のコメント

サインイン to comment.

Translated by