How to find the value of x when y = 0 and label on the curve?
    30 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    LIM MING HUI
 am 11 Apr. 2022
  
    
    
    
    
    Kommentiert: Star Strider
      
      
 am 12 Apr. 2022
            Hello,
I'm trying to find and label the coordinate of (x,y) when y=0 but I don't succeed.

x = 0:0.01:66.03;
y=(3.7*(10*(x/66.03).^3-15*(x/66.03).^4+6*(x/66.03).^5)-1.86);
plot(x,y,'c-','LineWidth',3);
Thank you in advance for you help...
0 Kommentare
Akzeptierte Antwort
  Star Strider
      
      
 am 11 Apr. 2022
        x = 0:0.01:66.03;
y=(3.7*(10*(x/66.03).^3-15*(x/66.03).^4+6*(x/66.03).^5)-1.86);
x_at_y0 = interp1(y,x,0)
figure
plot(x,y,'c-','LineWidth',3);
hold on
plot(x_at_y0, 0, 'r+', 'MarkerSize',15)
hold off
text(x_at_y0, 0, sprintf('  \\leftarrow (%.2f, %.2f)',x_at_y0,0), 'Horiz','left', 'Vert','middle')
.
2 Kommentare
Weitere Antworten (1)
  KSSV
      
      
 am 11 Apr. 2022
        x = 0:0.01:66.03;
y=(3.7*(10*(x/66.03).^3-15*(x/66.03).^4+6*(x/66.03).^5)-1.86);
[val,idx] = min(abs(y)) ;
plot(x,y,'c-','LineWidth',3);
hold on
plot(x(idx),y(idx),'*r')
2 Kommentare
  KSSV
      
      
 am 11 Apr. 2022
				fun  = @(x) (3.7*(10*(x/66.03).^3-15*(x/66.03).^4+6*(x/66.03).^5)-1.86);
x0 = fzero(@(x) fun(x), 33)
fun(x0)
Siehe auch
Kategorien
				Mehr zu Axis Labels finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




