How to find an intersection between two lines on a plot?

1 回表示 (過去 30 日間)
Brice Ortiz
Brice Ortiz 2019 年 9 月 7 日
コメント済み: darova 2019 年 9 月 7 日
I have this code,
for P = [0; 1000; 2000; 6000; 10000; 12000; 12900; 13400; 13600; 13800; 14000; 14400; 15200; 16800; 18400; 20000; 22400];
Elon = [0; 0.0002; 0.0006; 0.0019; 0.0033; 0.0039; 0.0043; 0.0047; 0.0054; 0.0063; 0.0090; 0.0102; 0.0130; 0.0230; 0.0336; 0.0507; 0.1108];
d = 0.505;
r = d/2;
Area = pi*r^2;
GL = 2;
Stress = P/Area
Strain = Elon/GL
plot(Strain,Stress,'-x')
axis([0 0.06 0 120000]);
grid;
grid minor;
title('Stress vs. Strain')
xlabel('Strain')
ylabel('Stress, psi')
hold on;
text(0.00195,5.991e+04,'\leftarrow Proportional limit');
Proprtinal_limit = Stress(6)
E = (Stress(6)-Stress(1))./(Strain(6)-Strain(1))
refline(E,-30724)
axis([0 0.06 0 120000]);
end
I need to find the X and Y coordinates for the intersection of "Plot" and "refline".
  2 件のコメント
darova
darova 2019 年 9 月 7 日
Or use polyxpoly() if you have a toolbox

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

採用された回答

Star Strider
Star Strider 2019 年 9 月 7 日
Try this:
RL = Strain*E -30724; % ‘refline’ As Funciton Of ‘Strain’
D = RL - Stress; % Difference
[Du,ix] = unique(D, 'stable'); % Unique ‘D’ & Indices
IntsctX = interp1(D(ix), Strain(ix), 0) % Value Of ‘Strain’ At Intersection
IntsctY = E*IntsctX - 30724 % Value Of ‘Stress’ At Intersection
producing:
IntsctX =
0.00324479065349119
IntsctY =
68968.0850755092

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStress and Strain についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by