Extracting data from two matrices
11 ビュー (過去 30 日間)
古いコメントを表示
I have two matrices: X is 100 by 1e5, complex double and Y is 1 by 1e5. For each row, X matrix contains either one peak value or two peak values.
Based on the index(indices) of the (these) peak value(s), I have to know the corresponding value of Y matrix. But it is all random i.e. the peak values are different from each other. Also the X matrix contains complex values.
Please help.
Faisal
3 件のコメント
採用された回答
Image Analyst
2014 年 12 月 29 日
if you "need that value of x-axis where the second peak is located." then try this, where you start looking for the max starting from the half way point (just the right half of the signal).
middleElement = floor(length(X)/2);
[maxValue, index] = max(X(middleElement:end));
yIndexOfMax = index + middleElement;
yAtMax = Y(yIndexOfMax);
Note that X is your signal (normally what people call Y), and your Y is what people normally call x - not sure why you did it that way, but I followed your unconvential notation.
You might need to look at the magnitude, real part, or imaginary part of X instead of complex values because the max is not defined for a fully complex number.
9 件のコメント
Image Analyst
2015 年 1 月 15 日
I don't read the email associated with this account. Post a new question and someone will answer.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!