Find Ultimate Tensile Strength (max/peak of graph) given Stress and Strain Data
18 次查看(过去 30 天)
显示 更早的评论
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

Thank you for any help.
0 个评论
回答(1 个)
Star Strider
2020-2-5
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 个评论
Star Strider
2020-2-5
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!