Could someone please help me how to mark one specific point (at y =100)?
2 views (last 30 days)
Show older comments
Phat Nguyen
on 3 Jun 2021
Commented: Phat Nguyen
on 3 Jun 2021
x = [0,0.00275252,0.00321127,0.00342857,0.00359759,0.00400805,0.00434608,0.00473239,0.00497384,0.00526358,0.00540845,0.00589135,0.006833,0.00697787,0.00840241,0.0101408];
y = [0,96.8421,107.068,110.075,108.872,99.2481,92.9323,86.015,81.203,70.9774,67.0677,56.8421,43.0075,41.5038,33.985,33.0827];
plot (x,y,'r','LineWidth',2);
grid on;
xlabel('X');
ylabel('Y');
0 Comments
Accepted Answer
Walter Roberson
on 3 Jun 2021
x = [0,0.00275252,0.00321127,0.00342857,0.00359759,0.00400805,0.00434608,0.00473239,0.00497384,0.00526358,0.00540845,0.00589135,0.006833,0.00697787,0.00840241,0.0101408];
y = [0,96.8421,107.068,110.075,108.872,99.2481,92.9323,86.015,81.203,70.9774,67.0677,56.8421,43.0075,41.5038,33.985,33.0827];
[~, peakidx] = max(y);
target = 100;
x1 = interp1(y(1:peakidx), x(1:peakidx), target);
x2 = interp1(y(peakidx:end), x(peakidx:end), target);
plot(x, y, 'r');
hold on
xline([x1, x2], 'b')
yline(target, 'b')
hold off
3 Comments
Walter Roberson
on 3 Jun 2021
x = [0,0.00275252,0.00321127,0.00342857,0.00359759,0.00400805,0.00434608,0.00473239,0.00497384,0.00526358,0.00540845,0.00589135,0.006833,0.00697787,0.00840241,0.0101408];
y = [0,96.8421,107.068,110.075,108.872,99.2481,92.9323,86.015,81.203,70.9774,67.0677,56.8421,43.0075,41.5038,33.985,33.0827];
[~, peakidx] = max(y);
target = 100;
x1 = interp1(y(1:peakidx), x(1:peakidx), target);
x2 = interp1(y(peakidx:end), x(peakidx:end), target);
plot(x, y, 'r', [x1, x2], target, 'bo');
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown 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!