Thanks for your help,
Y2 ->
plotyy(X1,Y1,X2,Y2)
indexmax = find(max(Y2) == Y2);
should be:
indexmax = find(max(distance) == distance);
Nevertheless your code
[dmx,idx]=max(distance); % the distance max, location
works.
[dmx,idx]=max(Weg_mu_meter) % max. Abstand, Matrixzeile
tmx=Zeit(idx) % Zeit des maximalen Abstands
text(tmx,dmx,num2str([dmx tmx],'Max D=%.1f at %.1fsec'))
Result:
dmx =
23.5753
idx =
5130
tmx =
75.0820
I uploaded an image of the plot. The text is on the bottom right of the image. How can I put in next to the maximum?
Is it possible that dmx idx and tmx can give me out the numbers with the unit. Like s for second...