How to plot specific point on plot?

5 ビュー (過去 30 日間)
Celine Lim
Celine Lim 2018 年 9 月 1 日
編集済み: KALYAN ACHARJYA 2018 年 9 月 1 日
Hi all,
From the codes below I graphed 2 data sets on the same plot. I found the max height and min height for both plots but i've been trying to figure out how to plot on the graph the max point and min point. Any recommendations?
clear
clc
close all
f = 120;
data1 = load('trial1.txt');
data2 = load('trial2.txt');
t1 = [1/f : 1/f : length(data1)/f]; %divide f for sampling step size
t2 = [1/f : 1/f : length(data2)/f];
plot(t1,data1)
maxHeight1 = max(data1)
minHeight1 = min(data1)
hold on
plot(t2,data2)
maxHeight2 = max(data2)
minHeight2 = min(data2)
hold off
xlabel('Time (s)')
ylabel('Height (m)')
title('Time vs Height')
legend('Data Set 1', 'Data Set 2')

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 9 月 1 日
You can do that by using Markers Detail here
plot(x,y,'-p','MarkerIndices',[idxmin idxmax],'MarkerFaceColor','red','MarkerSize',15)
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 9 月 1 日
編集済み: KALYAN ACHARJYA 2018 年 9 月 1 日
Or you can do this way also Here

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by