In: Advanced Math
I would like to know how to plot two graphs in matlab and find where they intercept.
For this just I'll write code by taking example so that you can understand
% define x Axis and evaluate functions
x_points = -5:0.1:5;
function1 = -x+1;
function2 = x+1;
index_intersection = find(function1 == function2);
x_value_intersection = x_points(index_intersection);
y_value_intersection = function1(index_intersection);
% plot functions and intersection point:
curve1 = plot(x_points, function1);
hold on
curve2 = plot(x_points, function2);
intersection = plot(x_value_intersection, y_value_intersection,...
'Marker', '+', 'MarkerSize', 6, 'Color', 'r');
For your reference i i attached the code and graph which i have did my desktop
just try this example you can understand
If you have any questions please let me know
Please give me thumb up