### Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#">ここ</a>」をクリックしてください。

## Identifying certain x value of a graph when x is not dependent on y?

Stephen

### Stephen (view profile)

さんによって質問されました 2017 年 3 月 13 日

### Star Strider (view profile)

さんによって 回答されました 2017 年 3 月 13 日
Hi, I have plotted 2 columns of data from an excel sheet, I have identified several peaks and I would like to know the times associated with these peaks without just zooming in on each value. Basically is there a way to extract an x value given the graph, even though the x and y values are independent?
Similar code would be;
Time = Time/500;
FilterActive = sgolayfilt(Activity, 5, 9); % can be removed
peaks = findpeaks(FilterActive, 'MinPeakHeight', 0.4);
plot(Time, FilterActive)
Im very new and inexperienced with coding, so any help or suggestions are welcome and appreciated, thanks.

#### 0 件のコメント

サインイン to comment.

## 1 件の回答

### Star Strider (view profile)

2017 年 3 月 13 日

Ask for a second output from findpeaks.
If you want the indices of the peaks, just use:
[peaks, peak_loc_idx] = findpeaks(FilterActive, 'MinPeakHeight', 0.4);
The ‘x’ values (in the actual units of ‘x’) will then be:
xval = x(peak_loc_idx);
corresponding to the ‘x’ value at each peak.
There are other ways to get the ‘x’ values directly. See the documentation for findpeaks for details.

#### 0 件のコメント

サインイン to comment.

Translated by