function mat_analysis(strs, strn, lin_range)
lregress_strn = strn(lin_range); % MAKE SURE THIS IS IN THE RANGE OF
lregress_strs = strs(lin_range); % THE LINEAR REGION OF THE DATA!!
yfit = polyfit(lregress_strn,lregress_strs,1); % Finds E of data set
mod_E = yfit(:,1) % Sets E value
b = yfit(:,2) % For Yield calcs
yield_strs = mod_E * (strn - .2) + b; % Calculates the yield line data
UTS = max(strs); % Finds UTS. That makes things easy.
UTS_strn = strn(find(strs == UTS));
UTS_strn = UTS_strn(1); % Sometimes find returns multiple values
cutoff1 = 1;
for cutoff2 = 1:length(yield_strs) % Cuts off yield line at the right place
if yield_strs(cutoff2) < 0
cutoff1 = cutoff2; % For bottom
end
if yield_strs(cutoff2) > UTS % For top
break;
end
end
diff = [10000 0 0]; % Storage variable
figure;
hold on; % Plots the initial data
plot(strn, strs, strn(cutoff1:cutoff2), yield_strs(cutoff1:cutoff2));
ylabel('MPa');
axis([0,strn(length(strn)),0,UTS + 20]);
if max(strn) > 5
legend('Engineering Stress vs. Strain', 'Yield Line', 'Location', 'Best');
title('2.002 Lab data: Tension Engineering Stress vs. Engineering Strain'); % CHANGE THIS FOR NEW TITLE
xlabel('percent');
else
legend('True Stress vs. Strain', 'Yield Line', 'Location', 'Best');
title('2.002 Lab data: Tension True Stress vs Trues Strain'); % CHANGE THIS FOR NEW TITLE
xlabel('log scale');
end
text(UTS_strn, (UTS - 30), strcat('\uparrow \sigma_T_S: ',num2str(UTS),'MPa'));
% ignore the man behind the curtain doing tricky functions
holder(500) = 0;
for pnt = 100:600 % REALLY simple least squares analysis, but works well
holder(pnt - 99) = (strs(pnt) - yield_strs(pnt))^2;
end
fgh = find(holder == min(holder));
diff(2) = strs(fgh(1) + 99);
diff(3) = strn(fgh(1) + 99);
plot(diff(3), diff(2), '*') % Puts a * on the yield point
text(diff(3), diff(2), strcat('\leftarrow \sigma_y:', num2str(diff(2)), 'MPa'));
ptr = lin_range(floor((length(lin_range) / 2)));
if (diff(2) / 2) > strs(ptr)
ypos = diff(2) / 2;
ptr = find(strn == diff(3));
else
ypos = strs(ptr);
end
text(strn(ptr(1)), ypos, strcat('\leftarrow E:', num2str(mod_E), 'MPa/%'));
% More text stuff, labels sig_y and E
hold off;
没有合适的资源?快使用搜索试试~ 我知道了~
mat_analysis.zip_data analysis_strain_stress
共1个文件
m:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 52 浏览量
2022-07-15
10:59:53
上传
评论
收藏 1KB ZIP 举报
温馨提示
strain-stress curve experimental data sheet
资源推荐
资源详情
资源评论
收起资源包目录
mat_analysis.zip (1个子文件)
mat_analysis.m 2KB
共 1 条
- 1
资源评论
weixin_42651887
- 粉丝: 79
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功