How to draw a tangent line to the curve?(tangent line has to pass through origin)

18 views (last 30 days)
Hi everbody, I plotted this particular curve,but ı have to draw a tangent line,which has to pass through origin, to the curve. I'd really appreciate your help.
Cd0 = 0.017;
Cl0 = 0.1;
K = 0.075;
Cl = 0:0.02:1.6;
Cd = Cd0 + K*(Cl - Cl0).^2;
plot(Cd,Cl)
This is how the plot looks like
  3 Comments
Furkan Yürümez
Furkan Yürümez on 23 Apr 2020
Edited: Furkan Yürümez on 23 Apr 2020
first of all, thanks for your help but the line has to pass through origin(0,0)
William Andriamihaja
William Andriamihaja on 9 Sep 2020
How did you make your drag polar look so smooth? I'm doing the same thing but mine looks horrible.

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 23 Apr 2020
Edited: John D'Errico on 23 Apr 2020
You are plotting a parabola on its side. Then you want to find the point where a line that passes through the origin, is also tangent to the curve.
First, what is the equation of a line that passes through the origin, given that Cl and Cd are your variables. Here, the variable Cd lies on the x axis, so it is the independent variable. The only unknown is the slope, since the line must pass through the origin. So we would have a line with equation
Cl = s*Cd
for some unknown slope s. If the line intersects the curve at a tangent point, then there is only ONE point of intersection. Just solve the system of two equations. That is most easily done by eliminating one of the variables.
Cd = Cd0 + K*(s*Cd - Cl0).^2
If we expand this into a quadratic in a standard form, then look at what is inside the sqrt. I'll do this using MATLAB, so I can claim to have used MATLAB to solve a problem that really is just algebra.
syms Cd Cd0 Cl0 K s
>> solve( Cd == Cd0 + K*(s*Cd - Cl0).^2,Cd)
ans =
((- 4*Cd0*K*s^2 + 4*Cl0*K*s + 1)^(1/2) + 2*Cl0*K*s + 1)/(2*K*s^2)
(2*Cl0*K*s - (- 4*Cd0*K*s^2 + 4*Cl0*K*s + 1)^(1/2) + 1)/(2*K*s^2)
For a unique intersection to exist, that discriminant must be zero. So now we have:
- 4*Cd0*K*s^2 + 4*Cl0*K*s + 1 == 0
This allows us to compute the two possible slopes of lines that touch the parabola at a point of tangency...
solve(- 4*Cd0*K*s^2 + 4*Cl0*K*s + 1 == 0,s)
ans =
(Cl0*K - (K*(K*Cl0^2 + Cd0))^(1/2))/(2*Cd0*K)
(Cl0*K + (K*(K*Cl0^2 + Cd0))^(1/2))/(2*Cd0*K)
You want the positive slope of those two, which must be the latter. Therefore we have a line of tangency as:
Cl = s*Cd
where s is given as
s = (Cl0*K + (K*(K*Cl0^2 + Cd0))^(1/2))/(2*Cd0*K)
Just pick two points on the line, and connect them. With actual numbers, we would have...
Cd0 = 0.017;
Cl0 = 0.1;
K = 0.075;
Cl = 0:0.02:1.6;
Cd = Cd0 + K*(Cl - Cl0).^2;
s = (Cl0*K + (K*(K*Cl0^2 + Cd0))^(1/2))/(2*Cd0*K);
Clmax = 1.6;
plot(Cd,Cl,'b-',[0,Clmax/s],[0,Clmax],'r-')
Yes, there are other ways this could have been done, perhaps using the dreaded calculus. EEK! ;-) But this solution requires nothing more than understanding the quadratic formula, and a little algebra.

More Answers (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 23 Apr 2020
One quich-n-easy solution graphically is to use ginput() by which you can select two or more points and then plot the selected data.

darova
darova on 23 Apr 2020
Here is the success condition:
Numerical approach
dx = 0.1;
f1 = @(x0) (interp1(x,y,x0+dx) - interp1(x,y,x0))/dx;
f2 = @(x0) (interp1(x,y,x0)-0)/(x0-0);
Or you can take derivative from your function

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!