Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE, solve this tis prblem by using MATLAB,, The following table includes exp

ID: 3781976 • Letter: P

Question

PLEASE, solve this tis prblem by using MATLAB,,

The following table includes experimental data for a stress strain test of a granular material: Use the saturation-growth-rate model to fit the data using linear regression to represent stress as function of strain. Find the coefficient of determination for this fit in the transformed space and in the original space. Fit the data to a fourth order polynomial. Note that the model should ensure zero stress at zero stress. Write down the resulting polynomial. Find the coefficient of determination for this fit. Fit the data to the following nonlinear function: y = a_0 x^a_1 e^a_2 x. Use nonlinear regression to define the function. Find the coefficient of determination for this fit. Plot the original data along with the three fits from parts (a) through (c). Comment on the results.

Explanation / Answer

a,d,c ansers:

%% Load and manipulate the data

load Example.dat

strain = Example(:,1) * 9.81;

stress = Example(:,2) * 2.54 / 100;

%% Rename and create model data

X1= strain;

Y1= stress;

sxmodel = linspace(min(x1), max(x1), 100);

%% Define model equation and A matrix

model = 'linear'

switch model

    case 'linear'

        yeqn1 = @(coefs, x1) coefs(1)*x1.^1 + coefs(2)*x1.^0;

        A1   =                     [x1.^1            x1.^0];

    case 'quadratic'

        yeqn1 = @(coefs, x1) coefs(1)*x1.^2 + coefs(2)*x1.^1 + coefs(3)*x1.^0;

        A1    =   [x1.^2            x1.^1           x.^0];

    case 'line through origin'

        yeqn1 = @(coefs, x1) coefs(1)*x1.^1;

        A1   =                    [x1.^1];

    case 'trig'

        yeqn1 = @(coefs, x1) coefs(1)*cos(x1) + coefs(2)*sin(x1);

        A1    =                     [cos(x1)            sin(x1)];

    case 'trig with offset'

        yeqn1 = @(coefs, x1) coefs(1)*cos(x1) + coefs(2)*sin(x1) + coefs(3)*x1.^0;

        A1    = [cos(x1)            sin(x1)         x1.^0];

    otherwise

        error('Don''t know the model...')

end

%% Determine the function coefficients

MyCoefs = A1y1

%% Generate estimates and model

yhat   = yeqn1(MyCoefs, x1);

symodel = yeqn1(MyCoefs, sxmodel);

%% Calculate statistics

% Compute sum of the squares of the data residuals

St1 = sum(( y1 - mean(y1) ).^2)

% Compute sum of the squares of the estimate residuals

Sr1 = sum(( y1 - yhat ).^2)

% Compute the coefficient of determination

r2 = (St1 – Sr1) / St1

%% Generate plots

plot(x1,      y1,      'ko',...

     x1,      yhat,   'ks',...

     sxmodel, symodel, 'k-');

xlabel('Independent Value')

ylabel('Dependent Value')

title('Dependent vs. Independent and Model')

legend('Data', 'Estimates', 'Model', 0)

b)

%% Load and manipulate the data

load example.dat

strain= example(:,1) * 9.81;

stress = Cantilever(:,2) * 2.54 / 100;

%% Rename and create model data

X1 = strain;

Y1= stress;

sxmodel = linspace(min(x1), max(x1), 100);

%% Determine the polynomial coefficients

N = 4;

P1 = polyfit(x1, y1, N)

%% Generate estimates and model

yhat   = polyval(P1, x1);

ymodel = polyval(P1, sxmodel);

%% Calculate statistics

% Compute sum of the squares of the data residuals

St1 = sum(( y1 - mean(y1) ).^2)

% Compute sum of the squares of the estimate residuals

Sr1 = sum(( y1 - yhat ).^2)

% Compute the coefficient of determination

r2 = (St1 – Sr1) / St1

%% Generate plots

plot(x1,      y1,      'ko',...

     x1,      yhat,   'ks',...

     sxmodel, symodel, 'k-');

xlabel('Independent Value')

ylabel('Dependent Value')

title('Dependent vs. Independent and Model')

legend('Data', 'Estimates', 'Model', 0)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote