Curve Fitting Young's Modulus for Stress Strain Curve
46 次查看(过去 30 天)
显示 更早的评论
Hello everyone! I am trying to find the elastic modulus for all my datasets (6 total split across two donors) and I am struggling to implement it into my code. I have been advised to use the 0.002 offset to find the yield point and then fit a line to that point on my stress-strain curve. I know I should probably sue polyfit but I have been struggling to get it to look right and so I have my code for my stress-strain curves below. Any help would be great!
% load files
files =
legend;
hold off;
5 个评论
Sam Chak
2025-3-7
Hi @Ella
Originally, you used polyfit, but the fitting appeared unsatisfactory. I wonder if this fitting topic is covered by the mechanical professor or the numerical analysis professor. It is true that any continuous curve can be fitted by a polynomial of arbitrary order, provided certain conditions are met, according to the Weierstrass approximation theorem. If a stress–strain curve exhibits elasto-plastic behavior, you may consider using the Ramberg–Osgood model.
By the way, if the .CSV file or the .ZIP file is too large, you may upload only one set of data so that the experts here can demo how the fitting can be performed.
回答(1 个)
Star Strider
2025-3-7
I am not certain what you want to do. To fit the initial linear portion of the curve, you can either usee polyfit or mldivide, \
Try something liike this —
% load files
files = dir('*.csv');
d1_files = files(contains({files.name}, 'D1'));
d2_files = files(contains({files.name}, 'D2'));
d64 = 257 * 10^(-3); % mm
d93 = 255 * 10^(-3); % mm
A64 = (pi/4)*d64^2 ; %mm^2
A93 = (pi/4)*d93^2 ; %mm^2
l0 = 40 ; %mm
%% stress strain curves
% donor 1
figure;
hold on;
for i = 1:length(d1_files)
data = readmatrix(d1_files(i).name); % Load data
strain = data(:,1) / l0; % Calculate strain
stress = data(:,2) / A64; % Calculate stress
plot(strain, stress, 'DisplayName', strrep(d1_files(i).name,'_','\_')); % Plot strain vs stress
dssdsn = gradient(stress, strain);
hold on
% plot(strain, dssdsn)
% hold off
idx = find(diff(sign(dssdsn-5E+5))); % Use ‘gradient’ To Deteermine Linear Portion
% xline(strain(idx(end)))
idxrng = 1:idx(end);
DM = [strain(idxrng) ones(size(strain(idxrng)))];
B = DM \ stress(idxrng);
lrline = DM * B;
plot(strain(idxrng), lrline, '--r', DisplayName=sprintf('Linear Regression: stress = %9.3E \\times strain %+.3f', B))
end
xlabel('Strain');
ylabel('Stress (MPa)');
title('Stress-Strain Curve for Donor 1');
legend(Location='best')
hold off;
% donor 2
figure;
hold on;
for i = 1:length(d2_files)
data = readmatrix(d2_files(i).name); % Load data
strain = data(:,1) / l0; % Calculate strain
stress = data(:,2) / A93; % Calculate stress
plot(strain, stress, 'DisplayName', d2_files(i).name); % Plot strain vs stress
end
xlabel('Strain');
ylabel('Stress (MPa)');
title('Stress-Strain Curve for Donor 2');
legend;
hold off;
.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Stress and Strain 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!