Find the point of intersection and plot it

I am trying to find the point of intersection between Stall speed and Take off run and I also want to mark that point on the graph.
This is the code I am using.
%Stall Speed
rho = 0.002378; % at sea level
Clmax = 2.7;
Vs = 189.056;
WvS = 0.5*rho*Vs^2*Clmax;
x1 = WvS;
x2 = WvS;
y1 = 0;
y2 = 8;
plot([x1,x2],[y1,y2],'-g')
text(95,1.2,'Stall speed')
axis([0 120 -0.1 2])
xlabel('W/S, lb/ft^2')
ylabel('T/W, lb/lb')
grid on
hold on
% Maximum speed
rho = 0.002378; % at sea level
Vmax = 987.48;
K = 0.0397887;
rho30 = 0.00089;
rhos = 0.374; % sigma
WS = 0:0.1:160;
TWvmax = ((1.23488./WS)+(0.000414*WS));
plot(WS,TWvmax,'--r')
hold on
text(60,-0.01,'Maximum speed')
% Take-off run
nu = 0.04;
Cdg = 0.029228876;
Clr = 1.875;
rho5 = 0.002048; % at 5000ft
g = 32.2;
Sto = 8000;
TWsto = ((nu-(nu+(Cdg./Clr))*((exp(0.6*rho5*g*Cdg*Sto*(1./WS)))))./(1-exp(0.6*rho5*g*Cdg*Sto*(1./WS))));
plot(WS, TWsto,'b--')
text(4,-0.01,'Take-off run')
hold on
% Rate of climb.
TWroc = (0.589143./sqrt(WS)+0.055556);
plot(WS, TWroc,'--c')
text(7,0.3,'Rate of climb')
% Cruise ceiling
sigmac = 0.31;
rho35 = 0.000738; % at 35000ft
Cd0 = 0.018;
K = 0.0397887;
LDmax = 18;
TWhc = (0.084699./sqrt(WS)+0.179211);
plot(WS, TWhc,'-m')
text(90,0.3,'Cruise ceiling')
hold on
legend('Stall Speed', 'Maximum Speed', 'Take-off Run', 'Rate of climb', 'Cruise ceiling')
This is the graph that I obtain.
I need the intersection point of the blue dotted line and the green vertical line.
I attempted this using the following code, however, it works for every function but the take-off run which is what I need.
% Find design point coordinates
[xint,yint] = polyxpoly([x1,x2],[y1,y2],WS,TWsto);
plot(xint,yint,'ok')
text(65,-0.2,'Design point')
disp([xint,yint])

Answers (1)

KSSV
KSSV on 9 Sep 2020
This function https://www.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections works like a charm for finding intersection points.

2 Comments

I'm not quite how this code works, seems very complex.
It is simple read the help part of the function.

Sign in to comment.

Asked:

on 9 Sep 2020

Commented:

on 9 Sep 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!