So "plot(time,Power,'o'); %not sure how to select a single number" will show specific points, and It would help if you ran this code to see what I meant, and use "partAQ2([0,5,2;1,3,4;2,5,8])" to call the function so we're on the same page.
I just want to only plot the maximum power, which in this case is 40W. I want to do this in CODE not in the editor which I don't know how to use anyway. If anyone has any suggestions I'd appreciate it.
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
%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,Power,'o'); %not sure how to select a single number
xlabel('time (s) '); ylabel(' Power (W) ');title( ' Power Used Over Time Drawn From Robot ');hold off %stop holding
end
Best Answer