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

조회 수: 5 (최근 30일)
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 CenterFile Exchange에서 2-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