how to find intersection data between 2 function
Mostrar comentarios más antiguos
hi guys can u help me to find the data which is intersection between 2 line ?
this is my graph :

i have data for the blue-line graph. so that i have data for points A,B,C.
The red line is an extended linear line from point A to B.
The yellow line is an vertical line when X = C
How do i get the intersection data between red-line and yellow-line ? the code formula.
Respuesta aceptada
Más respuestas (1)
@Arif A rough idea:
% Assuming you have the following coordinates
% A(xA, yA), B(xB, yB), and the x-coordinate of C (xC)
xA = % (your data for xA)
yA = % (your data for yA)
xB = % (your data for xB)
yB = % (your data for yB)
xC = % (your data for xC)
% Calculate the slope of the line AB (red line)
m = (yB - yA) / (xB - xA);
% Calculate the y-coordinate of the intersection point with the yellow line
yIntersect = m * (xC - xA) + yA;
% Display the intersection point
fprintf('The intersection occurs at (x, y) = (%.2f, %.2f)\n', xC, yIntersect);
Note:
- May need adjustment as per your requirement
---------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.
1 comentario
Walter Roberson
el 1 de Mzo. de 2024
@Arif comments
THANK YOU. It helps so much
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

