My scatter plot points aren't showing up on my main line plot.

5 ビュー (過去 30 日間)
Dr. Doom
Dr. Doom 2024 年 3 月 27 日
コメント済み: Star Strider 2024 年 3 月 28 日 17:24
I am attempting to callout the peak on both line plots by plotting the data, then using the (max) function to callout the max values of both the x and y values for each line.
How should I call the "t value" that is at the same point as the "max s" value for s2 and s3? I think max(t) is what is throwing off my scatter plots. t, s2, and s3 are all single cloumn matricies of different lengths.
%finding max values for t & s
tmax = max(t);
s2max = max(s2);
s3max = max(s3);
scatter(tmax,s2max,'o','r','LineWidth',1.5)
scatter(tmax,s3max,'o','r','LineWidth',1.5)

採用された回答

Star Strider
Star Strider 2024 年 3 月 27 日 23:35
Perhaps something like this —
[s2max,s2idx] = max(s2);
[s3max,s3idx] = max(s3);
figure
hold on
scatter(t(s2idx),s2max,'o','r','LineWidth',1.5)
scatter(t(s3idx),s3max,'o','r','LineWidth',1.5)
hold off
.
  8 件のコメント
Dr. Doom
Dr. Doom 2024 年 3 月 28 日 17:07
Nevermind I figured it out... (D'oh!)
I used t_3 instead of just t as my varialbe.
Star Strider
Star Strider 2024 年 3 月 28 日 17:24
No worries!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by