I want to plot the Point directly on the highest point of the graph

3 ビュー (過去 30 日間)
William Grant
William Grant 2020 年 3 月 6 日
編集済み: Bhaskar R 2020 年 3 月 6 日
I'd like some advice on how to do something like the plots below.
function MaxPower = partAQ2(ElectricalData)
%Creates a plot and shows the maximum power on a graph Power vs Time.
data = ElectricalData;
time = data(:,1); %extracts all the 1st column and transpose (s)
volts = data(:,2); %extracting all the 2nd column and transpose (V)
amps = data(:,3); %extracting all the 3rd column and transpose (A)
Power = amps.*volts; %element wise so it can multiply each by each, creating power
MaxPower = max(Power);
%plotting power vs time graph first
plot(time,Power); % time vs power.
hold on %allows for more to me added
grid on %I like grids
plot(time(end),MaxPower,'or','MarkerFaceColor', 'r'); %not sure how to select a single number, internet research was useless.
xlabel('time (s) ');
ylabel(' Power (W) ');
title( ' Power Used Over Time Drawn From Robot ');
legend('Power Over Time' , 'Maximum Power Drawn ','Location', 'west' ); %some reason the legend blocks the plot.
hold off %stop holding
end
I want it do something like this
While my code is doing this, and can anyone suggest how to make the circle hollow like that in my code?

採用された回答

Bhaskar R
Bhaskar R 2020 年 3 月 6 日
編集済み: Bhaskar R 2020 年 3 月 6 日
[MaxPower, MaxPow_loc] = max(Power); % then apply
hold on;
plot(MaxPow_loc,MaxPower,'or','MarkerFaceColor', 'r', 'MarkerSize',10);

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by