Find Ultimate Tensile Strength (max/peak of graph) given Stress and Strain Data
9 views (last 30 days)
Show older comments
I have included the .xlsx file for the stress and strain values required to determine the Ultimate Tensile Stress (UTS).
I need to determine each UTS which is the maximum value of the curve and locate it on the graph. I need to plot all five UTS points on the graphs.
I have tried to use max, islocalmax, and findpeaks but I can not get the code to work.
Here is my code thus far
% READS DATA FILE
filename = 'TensileMEX-4545XYZ.xlsx';
data = xlsread(filename);
S1 = data(:,1:2);
S2 = data(:,4:5);
S3 = data(:,7:8);
S4 = data(:,10:11);
S5 = data(:,13:14);
matrix = [S1 S2 S3 S4 S5]; %Required to condense data to Nx10 matrix
matrix(matrix < 0.015) = NaN; %Ignores Values less than 0.015
% PLOTS STRESS-STRAIN CURVES
figure(1)
plot(matrix(:,1), matrix(:,2),'r')
hold on
plot(matrix(:,3), matrix(:,4),'k')
plot(matrix(:,5), matrix(:,6),'g')
plot(matrix(:,7), matrix(:,8),'b')
plot(matrix(:,9), matrix(:,10),'m')
title('Data Set 1, ME2016 HW3, Camila Gill')
xlabel('Strain [%]')
ylabel('Stress [MPa]')
% LOCATES UTS FOR EACH SAMPLE
[UStrs, UStrn] = findpeaks(matrix(:,1),matrix(:,2));
The last line is the most recent attempt, but the following error occur
>>Error using findpeaks
>>Expected X to be finite![Screen Shot 2020-02-05 at 4.01.19 PM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270158/Screen%20Shot%202020-02-05%20at%204.01.19%20PM.png)
![Screen Shot 2020-02-05 at 4.01.19 PM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270158/Screen%20Shot%202020-02-05%20at%204.01.19%20PM.png)
Thank you for any help.
0 Comments
Answers (1)
Star Strider
on 5 Feb 2020
This line:
matrix(matrix < 0.015) = NaN; %Ignores Values less than 0.015
is inserting NaN values into ‘matrix’, and that is causing problems with findpeaks. The stress data are all significantly greater than that, so why not just delete that line?
2 Comments
Star Strider
on 5 Feb 2020
You can, however the reason for doing that (or assigning it as NaN) is not obvious to me. The values you want (and that findpeaks returns) are significantly in excess of that value, so I seriously doubt that findpeaks will even consider it.
I would just eliminate that line. That should solve the problem.
See Also
Categories
Find more on Stress and Strain in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!