The following is for, Exercises 3 - 4: A tensile test of a material has provided
ID: 2084854 • Letter: T
Question
The following is for, Exercises 3 - 4: A tensile test of a material has provided the stress-strain data that is given in Figure 29.3e. Figure 29.3e - Strain and stress values of a composite material. The strain (cm/cm) and stress (MPa) are given in the first and second columns, respectively. Write a MATLAB program that reads the input text file given in Figure 29.3e, and outputs (to the command window) the longitudinal Young's modulus of the composite material. To find the Young's modulus, you may use the following regression model E = sigma^n_i = 1 sigma_i epsilon_i/sigma^n_i = 1 (epsilon_i)^2 where E is the Young's modulus (Pa), epsilon is strain (m/m), sigma is stress (Pa). Use the fprintf command with %e format to display your output in the command window. Be sure to note the units.Explanation / Answer
fileID = fopen('stress_data.txt','r');
formatSpec = '%f %d';
sizeA = [2 Inf];
A = fscanf(fileID,formatSpec,sizeA);
fclose(fileID);
A1 = A(1,:);%first row cm/cm = m/m so no changes
A2 = A(2,:);%second row is MPa so we need convert this into Pa by multiplying with 10^6
sum1 =0;
sum2 = 0;
for i=1:length(A(1,:))
sum1 = sum1+(A1(i)*A2(i)*10^6);%taking the sum of nominator
sum2 = sum2+(A1(i));%taking the sum of denominators
end
E = sum1/sum2;
fprintf('Youngs Modululs: %e Pa ',E);
command window output:
Youngs Modululs 2.178168e+009 Pa
>>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.