フィルターのクリア

How to find both of the local minimums in this plot ?

1 回表示 (過去 30 日間)
farzad
farzad 2015 年 4 月 7 日
コメント済み: farzad 2015 年 4 月 7 日
Hi All
just having the vectors of the axes , how can I find the minimums ?
  2 件のコメント
dpb
dpb 2015 年 4 月 7 日
What does "just having the vectors of the axes" mean, precisely? If you don't have the y-axis data values that plotted the curve, you have nothing. Of course, if you do have the figure by having been sent it as a .fig file say, but not the data that drew it, you can obtain such by finding the handle for the line on the axes and querying it for the '[x|y]data' properties.
farzad
farzad 2015 年 4 月 7 日
I have both the x and y data

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

採用された回答

Image Analyst
Image Analyst 2015 年 4 月 7 日
If you have the Signal Processing Toolbox, invert your data and call findpeaks().
y = max(y) - y;
[peaks, indexes] = findpeaks(y);
  4 件のコメント
Image Analyst
Image Analyst 2015 年 4 月 7 日
farzad, I don't know what you tried since you didn't attach your code. So I made a full demo:
s = load('y.mat')
y = s.weight;
s = load('x.mat')
x = s.D11;
% Plot original data.
subplot(1,2,1);
plot(x, y, 'b-', 'LineWidth', 3)
grid on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Flip the data.
yFlipped = max(y) - y;
% Plot flipped data.
subplot(1,2,2);
plot(x, yFlipped, 'b-', 'LineWidth', 3)
grid on;
[peaks, indexes] = findpeaks(yFlipped)
xPeaks = x(indexes)
% Indicate the peaks on the flipped graph
hold on;
plot(xPeaks, peaks, 'r*', 'LineWidth', 3, 'MarkerSize', 15);
% Go back to the unflipped plot and indicate them.
subplot(1,2,1);
hold on;
plot(xPeaks, y(indexes), 'r*', 'LineWidth', 3, 'MarkerSize', 15);
% Draw lines from lower axis to valleys
yl = ylim();
for k = 1 : length(peaks);
line([xPeaks(k), xPeaks(k)], [yl(1), y(indexes(k))], ...
'LineWidth', 3, 'Color', 'm');
end
dpb, it flips the data, not translates it. Though I agree, it could be done with -y instead of max(y)-y.
farzad
farzad 2015 年 4 月 7 日
Thanks a lot !

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by