フィルターのクリア

How to display Intersection of two graphs

2 ビュー (過去 30 日間)
Austen Thomas
Austen Thomas 2018 年 3 月 15 日
コメント済み: David Lont 2020 年 3 月 28 日
I am writing a code and plotting to set of equations against each other T_R and T_A. How can you make it so it disaplys the point where the two lines intersect?
I have attached the code and a picture of the graph thanks to anyone who can help
  3 件のコメント
Austen Thomas
Austen Thomas 2018 年 3 月 15 日
編集済み: Walter Roberson 2018 年 3 月 15 日
%%Problem 1 a
clc, clear
S = 135.2; % ft^2
b = 35.5; % ft
C_D0 = 0.019;
e = 0.83;
W = 3000; % lbs
P_SSL = 195 * 0.85; %hp
rho_SSL = 0.002377;
AR = 9.321;
K = 1/(pi*e*AR);
hG = 1;
rho = 0.002377;
v = 40:10:750;
for i = 1:length(v)
q(i) = 0.5 * rho * v(i)^2;
C_L(i) = W / (q(i) * S);
Dp(i) = q(i) * S * C_D0;
Di(i) = q(i) * S * K * C_L(i)^2;
T_R(i) = Dp(i) + Di(i);
end
plot(v,T_R);
hold on
for i = 1:length(v)
P_A(i) = P_SSL * (1.132 * (rho / rho_SSL) - 0.132);
T_A(i) = (P_A(i) * 550) / v(i);
end
David Lont
David Lont 2020 年 3 月 28 日
Thank you! This is very useful as I believe it is the same exact assigment I have with Dr. Ro at WMU in spring of 2020.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2018 年 3 月 15 日
You need to create ‘T_A’ and ‘T_R’ as anonymous functions. After that, you can use fzero to calculate the intersection.
The Code
S = 135.2; % ft^2
b = 35.5; % ft
C_D0 = 0.019;
e = 0.83;
W = 3000; % lbs
P_SSL = 195 * 0.85; %hp
rho_SSL = 0.002377;
AR = 9.321;
K = 1/(pi*e*AR);
hG = 1;
rho = 0.002377;
v = 40:10:750;
q = @(v) 0.5 * rho * v.^2;
C_L = @(v) W ./ (q(v) * S);
Dp = @(v) q(v) * S * C_D0;
Di = @(v) q(v) * S * K .* C_L(v).^2;
T_R = @(v) Dp(v) + Di(v);
P_A = P_SSL * (1.132 * (rho / rho_SSL) - 0.132);
T_A = @(v) (P_A * 550) ./ v;
v_int = fzero(@(v) T_R(v) - T_A(v), 300);
plot(v, T_R(v), v, T_A(v))
hold on
plot(v_int, T_R(v_int), 'pg', 'MArkerFaceColor','g', 'MarkerSize',8)
hold off
grid
xlabel('v')
legend('T_R', 'T_A')
text(v_int+20, T_R(v_int)+20, sprintf('\\leftarrow (%.1f, %.1f)', v_int, T_R(v_int)), 'HorizontalAlignment','left', 'VerticalAlignment','middle')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetworks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by