How to find the point in a plot that indicate to the beginning of a curve?

6 views (last 30 days)
Dear all,
I have a two dimension plot X, Y as shown in the attached image below. X and Y are linearly increase together, however at some point X will increase but y will not increase, and this simply will cause a curve in the plot.
My question is how to find the point X that indicate the beginning of the curve in the plot?
Any help will be appreciated.
Meshoo

Answers (1)

Mischa Kim
Mischa Kim on 24 Sep 2014
Edited: Mischa Kim on 24 Sep 2014
Meshooo, you could use something like
x = 0:0.1:10;
y = sin(x);
plot(x,y)
xp = min(x(diff(y)<0))
diff computes the differences in array elements, sort of the first derivative of y. xp therefore marks the first x for which the derivative of y is negative.
  4 Comments
Meshooo
Meshooo on 25 Sep 2014
Edited: Meshooo on 25 Sep 2014
Thank you very much Mischa.
I want to find the point where the plot takes a big change. In another words I want to find the point where the slope changes as I show here below.
Any idea will be appreciated.
Meshooo
Meshooo on 25 Sep 2014
Edited: Meshooo on 25 Sep 2014
XX = [143.3333
144.3333
145.3333
146.9333
147.1333
148.2667
149.1333
150.0667
151.3333
152.4000
153.6000
154.9333
156.2000
157.5333
159.0000
160.4000
161.8000
163.2667
164.6000
165.9333
167.4000
168.8667
170.3333
171.7333
173.2667
174.8667
176.4667
177.9333
179.4000
180.9333
182.1333
183.3333
184.6667
186.0000
187.1333
188.6000
189.8000
191.2000
192.4667
194.0667
195.3333
197.2000
198.7333
200.4000
201.9333
203.7333
205.2000
206.8667
208.6000
210.2667
211.7333
213.3333
215.0000
216.6000
218.0667
219.8667
221.6000
223.1333
224.7333
226.4667
227.9333
229.3333
230.8667
233.2000
234.3333
236.3333
237.9333
239.2000
239.6667
241.0667
241.6667
242.8667
244.0000
245.0667
246.8000
248.4000
249.9333
251.5333
253.1333
254.1333
254.1400
254.1500
254.1600
254.1700
254.1800
254.1900
254.2000
254.2100
254.2200
254.2300
254.2400
254.2500
254.2600
254.2700
254.2800
254.2900
254.3000
254.3100
254.3200
254.3300
254.3400
254.3500
254.3600
254.3700]
YY = 1:104;
plot(YY,XX)
% if I apply your code
xp = min(YY(diff(XX)<0))
Answer is :
Empty matrix: 1-by-0

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!