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

5 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Bhaskar R
Bhaskar R el 6 de Mzo. de 2020
Editada: Bhaskar R el 6 de Mzo. de 2020
[MaxPower, MaxPow_loc] = max(Power); % then apply
hold on;
plot(MaxPow_loc,MaxPower,'or','MarkerFaceColor', 'r', 'MarkerSize',10);

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by