Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Matlab script that reads data from a creep.csv and relax.csv file, both files have three columns: time, strain, stress. The behavior should be

Write a Matlab script that reads data from a creep.csv and relax.csv file, both files have three columns: time, strain, stress. The behavior should be modeled using a Kelvin model, the model equations are as follows:

Time constants:

= 2/1, = (2/3) * (1 + 3/1)

Creep loading and unloading:

() = (0/3) * [1 (1 (/)) * exp ((( 0)/))]

() = (0/3) * (1 (/)) * [1 exp (-(( 1 0)/))] * exp ( (( 1)/))

Stress relaxation:

() = 3 * 0 * [1 (1 (/)) exp ( (( 0)/))]

Determine the three constants (E1, 2, E3) which best fit the data, make the script return these constants. Note that you will want to normalize your error calculations using:

error = ((experimental model) / experimental)^2

in order to deal with the fact that stress and strain differ by orders of magnitude. You may also need to account for the fact that there are different number of data points per test. Afterwards, plot the strain-time and stress-time curves, include the curve of the fit data in the appropriate plots.

A script that I've written and half does it (must find a better 'params0' is bellow:)

% Read data from 'creep.csv' and 'relax.csv' files creep = readmatrix('creep.csv'); relax = readmatrix('relax.csv');

% Define model equations model_creep = @(params, time) (params(1)/params(3)) .* (1 - (1 - (params(2)/params(4)).*... exp(-(time - params(5))/params(4)))); model_relax = @(params, time) params(3) .* params(1) .* (1 - (1 - (params(4)/params(2)).*... exp(-(time - params(5))/params(2))));

% Define error function error_fun = @(params) sum(((creep(:,2) - model_creep(params, creep(:,1)))./creep(:,2)).^2) +... sum(((relax(:,3) - model_relax(params, relax(:,1)))./relax(:,3)).^2);

% Perform optimization to determine constants that best fit the data options = optimset('TolFun', 1e-12, 'TolX', 1e-12, 'MaxFunEvals', 10000); params0 = [5, 1, 5, 100, 10]; [params, error] = fminsearch(error_fun, params0, options);

% Display constants in table disp('Constants:'); disp('E1 eta2 E3'); disp(num2str(params(1:3)));

% Plot strain-time and stress-time curves figure; subplot(2,1,1); plot(creep(:,1), creep(:,2), 'k-', relax(:,1), model_relax(params, relax(:,1)), 'r-'); xlabel('Time'); ylabel('Strain'); legend('Creep data', 'Model fit');

subplot(2,1,2); plot(relax(:,1), relax(:,3), 'k-', relax(:,1), model_creep(params, relax(:,1)), 'r-'); xlabel('Time'); ylabel('Stress'); legend('Relaxation data', 'Model fit');

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Prepare a short profile of Henry words worth Longfellow?

Answered: 1 week ago

Question

What is RAM as far as telecommunication is concerned?

Answered: 1 week ago

Question

Question 1: What is reproductive system? Question 2: What is Semen?

Answered: 1 week ago