Matlab ////Create a custom function to calculate stress and strain during a tens
ID: 2074461 • Letter: M
Question
Matlab ////Create a custom function to calculate stress and strain during a tension or compression test. The input arguments should be force, cross-sectional area, deformation, original length. The output arguments should be stress and strain. Stress, ( or Pascals), is calculated as force divided by the original cross sectional area of the material tested. Strain, (%), is calculated as change in length divided by the original length. NOTE: Deformation is the same as (deformed length – original length) in the equation for strain. Test your function using the following values of force (N), cross-sectional area, CSA, (mm), deformation (mm), original length, L0 (mm): Def = 0.81, Force = 94.59, CSA = 24.01, L0 = 4 Def = 0.82, Force = 22.46, CSA = 24.01, L0 = 4
Explanation / Answer
function [ si,ep ] = test( f,a,del,l )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
si=f./a;
ep=del./l;
end
% Above code is function to generate stress and strain. Save it in different Matlab script with name "test.m"
clc
clear all
close all
f=[95.59 22.46];
a=[24.01 24.01];
del=[0.81 0.82];
l=[4 4];
[ si,ep ] = test( f,a,del,l );
disp(si)
disp(ep)
% Above is the command to call test function to calculate stress and strain