Basically I'm trying to find max/min values for a range of a graph using ginput to select the start and end of this range. I have many different graphs I want to use this for but for simplicity I'm trying to first do it on a basic sin function and can't seem to figure it out. As of now I have:
t = linspace(0,2*pi)';y = sin(t);plot(t,y)[time,~] = ginput(2)
%Selecting two random points gives the output
time =
0.3605 2.5930
Now how do I go about finding the max value of y within this chosen range of 0.3605<t<2.5930?
I know the answer will be 1 (sin function) but I'm trying to understand the concepts before applying it to the more complicated graphs I have
Best Answer