Frequency spectrum - Reading certain y-values

1 回表示 (過去 30 日間)
Mepe
Mepe 2019 年 3 月 27 日
編集済み: Adam Danz 2019 年 3 月 27 日
Given is the frequency spectrum of a measurement. The x-axis represents the frequency, the y-axis the amplitude. These are stored as individual column vectors. I am now interested in the amplitude values at certain frequencies (e.g., 2,3,4,5 MHz). How can I best "read" these and store them in a separate vector / matrix?
Thanks a lot!
  2 件のコメント
Adam Danz
Adam Danz 2019 年 3 月 27 日
If you share a sample of your data it would be easier to visualize what's going on.
Mepe
Mepe 2019 年 3 月 27 日
As already described, I would like to read defined x-values with the corresponding y-values. Attached are my measurement.
untitled.jpg
Thanks!

サインインしてコメントする。

採用された回答

Adam Danz
Adam Danz 2019 年 3 月 27 日
編集済み: Adam Danz 2019 年 3 月 27 日
How can I best "read" these and store them in a separate vector / matrix?
file = 'C:\Users\name\Documents\MATLAB\5M_60°_4_5MHz_20V_C.csv';
num = xlsread(file);
>> size(num)
%ans =
% 16385 2
I am now interested in the amplitude values at certain frequencies (e.g., 2,3,4,5 MHz).
%find freq closest to target
target = 2.0;
[~, closestIdx] = min(abs(num(:,1) - target));
num(closestIdx,:)
%ans =
% 1.9995 -74.481
If you're looking for specific peaks, check out findpeaks() function.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by