I need it in matlab form please ome Tools Project No. 4-Enalproiect [10% of Fina
ID: 2088836 • Letter: I
Question
I need it in matlab form please
Explanation / Answer
Y = [207.79, 155.43, 130.98, 100.97, 92.90, 77.13, 66.82, 63.97]' ;
d = [0.005, 0.009,.016, 0.025, 0.040, 0.062, 0.085, 0.110]' ;
%%%%%%%%%%%%% PART a %%%%%%%%%%
%Linear Model with Nonpolynomial Terms
sigma = [ones(size(d)) d.^(-0.5)] ; % Form the design matrix.
a = sigmaY ; % Calculate equation coefficients.
sigma_o = a(1,1) ;
k = a(2,1) ;
syms d1 % create a variable for grain size
f(d1) = sigma_o + k*(d1^(-0.5)) ; % generate Hall Petch equation
% Plot the data
figure ; % Open the plot
plot(d,Y,'o') ; % plot the given data with circular markers
hold on ;
fplot(f) ; % plot the Hall Petch equation
hold on ;
%%%%%%%%%%%%% Part b %%%%%%%%%%
data_from_part_b = [ 0.005, 0.01, 0.02, 0.03, 0.05, 0.10]' ;
Stress_linear_interpolation = interp1q(d,Y, data_from_part_b) ; % Stress values using Linear Interpolation method through interp1q function
Stress_Hall_petch = sigma_o + k*(data_from_part_b.^(-0.5)) ; % Stress values from Hall Petch equation
tab = table(data_from_part_b, Stress_linear_interpolation, Stress_Hall_petch) ; % generate a table to display data
%%%%%%%%%%%% PART c %%%%%%%%%%
plot(data_from_part_b, Stress_linear_interpolation, 'square') ; % Continue the plot by showing Linear Interpilation data with square markers
hold on ;
%%%%%%%%%%%% PART D %%%%%%%%%%
Stress_Cubic_Interpoation = spline(d, Y, data_from_part_b) ; % Stress values using cubic Interpolation method through spline function
plot(data_from_part_b, Stress_Cubic_Interpoation, '*' ) ; % Continue the plot by showing Linear Interpilation data with * markers
% Add the plot properties
title('Different Interpolation Methods') ;
xlabel('d (mm)') ;
ylabel('Y, (MPa)') ;
%%%%%%%%%%% PART e %%%%%%%%%
% As we can see in the plot that the cubic interpolation gives more
% accurate results as compared to linear interpolation. The stress values
% in case of cubic interpolation converges more towards the Hall Petch
% equation.