Hi, I think I can at least point you in the right direction:
The first step is to get the equation for the linear portion of the stress strain curve. I did this by noting that the curve passes through the origin and then taking the last point in the linear portion of the curve from the graph:
Now we have two points from the line, (0,0) and (0.002146,5.028e6) and we also know that the x intercept is 0.002 so we can generate an equation for this line as follows:
m = dy/dx
m = (0-5.028e6)/(0-0.002146)
m = 2.3430e9
y = mx + b
b = y-(mx) Substituting x = 0.002 and y = 0
b = 0 - 2.3430e9*(0.002)
b = -4686000
y = 2.3430e9x - 4686000
m = dy/dx
= (0-5.028e6)/(0-0.002146)
= 2.3430e+09
Y = mx + b
b = y-(mx) Substituting in 0.002 for x and 5.028e6 for y:
b = 2.3430e+09*-0.002
b = -4686000
then the equation for the line that is roughly parallel to the roughly linear portion of the stress strain curve, in y = mx + b form is:
y = 2.3430e+09x - 4686000
Now, we modify the original code to plot this new line to see where it will intersect with the stress strain curve and zoom in on the intersection area...
P = [0 5 10 30 50 60 65 67 68 69 70 80 90 100 110 120];
D = [0 0.0005 0.0015 0.0048 0.0084 0.0102 0.0109 0.0119 0.0137 0.0160 0.0229 0.0546 0.0965 0.1228 0.2814 0.3014];
L = 5.08 / 10;
A = pi * ((1.283 / 2) / 10) ^ 2;
D1 = D ./ 10;
P1 = P .* 1000;
G = P1 ./ A;
S = D1 ./ L;
y = 2.3430e+09*S - 4686000;
plot(S, G, '-o',S,y,'-k')
ylim([0,1e7])
xlim([0,0.01])
title('Axial Stress-Strain');
xlabel('Axial Strain');
ylabel('Axial Stress');
Next, from the resulting plot, we grab a data point on either side of the intersection and use these points to create another new line in y = mx + b format...
m = dy/dx
m = (5.337e6-5.414e6)/(0.00315-0.004508)
m = 5.6701e+07
y2 = mx + b
b = y-(mx) substituting x = 0.00315, y = 5.337e6
b = 5.337e6 - 5.6701e+07*(0.00315)
b = 5.1584e6
y2 = 5.6701e7x + 5.1584e6
Next, we modify the code again with y2 shown, just to kae sure the equation is looks right:
P = [0 5 10 30 50 60 65 67 68 69 70 80 90 100 110 120];
D = [0 0.0005 0.0015 0.0048 0.0084 0.0102 0.0109 0.0119 0.0137 0.0160 0.0229 0.0546 0.0965 0.1228 0.2814 0.3014];
L = 5.08 / 10;
A = pi * ((1.283 / 2) / 10) ^ 2;
D1 = D ./ 10;
P1 = P .* 1000;
G = P1 ./ A;
S = D1 ./ L;
y = 2.3430e+09*S - 4686000;
y2 = 5.6701e7*S + 5.1584e6;
plot(S, G, '-o',S,y,'--k',S,y2,'--r')
ylim([0,1e7])
xlim([0,0.01])
title('Axial Stress-Strain');
xlabel('Axial Strain');
ylabel('Axial Stress');
legend('Stres Vs Strain','Linear Approx of Linear Stress Strain Curve','Linear approximation of SS Curve at intersection','location','southeast')
Everything looks good so now all we need to do is figure out where the lines y and y2 intersect and that will also be the point where y (the line that is parallel to the linear portion of the stress strain curve) intersects the stress strain curve...
To do this we modify the code again to use the fzero function to find the intersection, add that point to the plot. This is where it gets a little complicated but bear with me.
We will use the fzero function, info found here
This also requires the use of an anonymous function, info found here:
The anonymous function is required because fzero expects a function handle data type as its input...
Before all of that though, we have to get the equations arranged nicely for fzero. What fzero does is tries to find where the input equation is equal to a value that you give it so a trick that you can do is as follows:
We want to know where y = y2 but we only use one equation for fzero we create a new function:
f(x) = y - y2
We do this because, at the intersection of y and y2, they are both equal so y - y2 = 0. Now we can use fzero to find the intersection by telling fzero to look for the value of x where f(x) = 0 but we still need to make f(x) an anonymous function but that is easy, it looks like this:
fun = @(x) 2.3430e+09*x - 4686000 - 5.6701e7*x - 5.1584e6;
This will get us the value of x where y and y2 (and therefore also where y and the SS curve) intersect. The only thing left is to find the y-value where the intersection happens, we do that by substituing the x value into either y or y2 (since both functions are approximately equal at the intersection, we can use either one to find the y-value).
The code that I used to finish the job is as follows:
P = [0 5 10 30 50 60 65 67 68 69 70 80 90 100 110 120];
D = [0 0.0005 0.0015 0.0048 0.0084 0.0102 0.0109 0.0119 0.0137 0.0160 0.0229 0.0546 0.0965 0.1228 0.2814 0.3014];
L = 5.08 / 10;
A = pi * ((1.283 / 2) / 10) ^ 2;
D1 = D ./ 10;
P1 = P .* 1000;
G = P1 ./ A;
S = D1 ./ L;
y = 2.3430e+09*S - 4686000;
y2 = 5.6701e7*S + 5.1584e6;
fun = @(x) 2.3430e+09*x - 4686000 - 5.6701e7*x - 5.1584e6;
InterceptX = fzero(fun,0);
InterceptY = 2.3430e+09*InterceptX - 4686000;
plot(S, G, '-.',S,y,'--k',S,y2,'--r',InterceptX,InterceptY,'ko')
ylim([0,1e7])
xlim([0,0.01])
title('Axial Stress-Strain');
xlabel('Axial Strain');
ylabel('Axial Stress');
legend('Stres Vs Strain','Linear Approx of Linear Stress Strain Curve','Linear approximation of SS Curve at intersection','location','southeast')
I changed the markers on the SS curve to make the intersection point stand out. You can always change the marker properties of the intersection point to make it bigger and bolder but I didn't feel like going that route. The result should look something like this:
Hope that helps =)