How to I find the intersection point between y=x*exp(x)/(exp(x)-1) and y=3? I can't seem to have the intersection point displayed.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Craig Egan Allistair Tan
el 15 de En. de 2022
Comentada: Craig Egan Allistair Tan
el 15 de En. de 2022
x = 1:1:10;
f = @(x) x.*exp(x);
g = @(x) exp(x)-1;
y_1 = @(x) f(x)./g(x);
y_2 = @(x) yline(3,'b');
intersection = find(y_1(x)==y_2(x));
x_intersection = x(intersection);
y_intersection = y_1(intersection);
plot(x,y_1(x),'red')
hold on
plot(x,y_2(x),'blue')
intersection = plot(x_intersection,y_intersection,'Marker','+','Color''g')
0 comentarios
Respuestas (1)
Simon Chan
el 15 de En. de 2022
Editada: Simon Chan
el 15 de En. de 2022
Use function fzero to help you to find the intersection.
x = 1:1:10;
f = @(x) x.*exp(x);
g = @(x) exp(x)-1;
y_1 = @(x) f(x)./g(x);
y_2 = @(x) yline(3,'b');
y_intersect = 3;
x_intersect = fzero(@(x)y_1(x)-y_intersect, 10);
plot(x,y_1(x),'red')
hold on
plot(x,y_2(x),'blue')
intersection = plot(x_intersect,y_intersect,'g+');
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!