Instructions: Create a MATLAB script and name it with your USTA ID as \"abc123_l
ID: 3816851 • Letter: I
Question
Instructions: Create a MATLAB script and name it with your USTA ID as "abc123_lnlabEx6.m". You may use your notes, textbook. This exercise is due by the end of class. Email your published scripts in pdf format to md.haque@my.utsa.edu. Email subject: "First name Last name Ex.6 Consider the stress-strain relationship given in the table below: a. Use quadratic interpolation to find s when e = 0.04 b. Use linear interpolation to find e when s = 54 c. Use spline interpolation to find s when e = [0.03 0.06 0.08| d. For the stress strain relationship above, the modulus of toughness is given by U_t = integral^0.25 _0.02 sde. Obtain this integral using the following methods: i. Fit a cubic polynomial curve: s = a_3 e^3 + a_2 e^2 + a_1 e + a_0. With 0.02 and 0.25 as lower and upper limits, respectively, integrate analytically using symbolic computation. ii. Interpolate the data in the table to find the $ values for 7 linearly spaced points of e from 0.02 to 0.25 (i.e. generate 6 equal-sized segments). Next use multiple trapezoid or multiple Simpson's rule with the new data set obtained from interpolation. iii. Compute U_t using MATLAB's trap z function.Explanation / Answer
a)
clc;
clear all;
xdp = [0.02,0.05,0.1,0.15,0.22,0.25];
ydp = [40,37.5,43,52,60,55];
p = polyfit(xdp,ydp,2);
fprintf('Value at e = %d is %d ', 0.04,polyval(p,0.04) );
Output:
b)
clc;
clear all;
xdp = [0.02,0.05,0.1,0.15,0.22,0.25];
ydp = [40,37.5,43,52,60,55];
p = polyfit(xdp,ydp,1);
fprintf('Value at e = %d is %d ', 0.04,polyval(p,0.04) );
Output:
c)
clc;
clear all;
e = [0.03,0.06,0.08];
xdp = [0.02,0.05,0.1,0.15,0.22,0.25];
ydp = [40,37.5,43,52,60,55];
pp = spline(xdp,ydp);
for i = 1:3
fprintf('Value at e = %d is %d ', e(i),ppval(pp,e(i)));
end
Output:
d) i)
clc;
clear all;
xdp = [0.02,0.05,0.1,0.15,0.22,0.25];
ydp = [40,37.5,43,52,60,55];
p = polyfit(xdp,ydp,3);
s = @(e) ((e^3)*p(1) + (e^2)*p(2) + (e)*p(3) + p(4));
Y = zeros(1,size(xdp,2));
for i = 1:size(xdp,2)
Y(1,i) = s(xdp(i));
end
Q = trapz(xdp,Y);
fprintf('Value of integral = %d ', Q );
Output:
d) ii)
clc;
clear all;
xdp = [0.02,0.05,0.1,0.15,0.22,0.25];
ydp = [40,37.5,43,52,60,55];
p = polyfit(xdp,ydp,3);
s = @(e) ((e^3)*p(1) + (e^2)*p(2) + (e)*p(3) + p(4));
xdp2 = linspace(0.02,0.25,7);
Y = zeros(1,size(xdp2,2));
for i = 1:size(xdp2,2)
Y(1,i) = s(xdp2(i));
end
Q = trapz(xdp2,Y);
fprintf('Value of integral = %d ', Q );
Output:
d) iii)
clc;
clear all;
xdp = [0.02,0.05,0.1,0.15,0.22,0.25];
ydp = [40,37.5,43,52,60,55];
Q = trapz(xdp,ydp);
fprintf('Value of integral = %d ', Q );
Output: