How to find an intersection between two lines on a plot?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Brice Ortiz
am 7 Sep. 2019
Kommentiert: darova
am 7 Sep. 2019
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 Kommentare
Walter Roberson
am 7 Sep. 2019
https://www.mathworks.com/matlabcentral/fileexchange/11837-fast-and-robust-curve-intersections and similar in the File Exchange.
Akzeptierte Antwort
Star Strider
am 7 Sep. 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Stress and Strain finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!