Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask MATLAB Expert

A group of students have collected mechanical data (on a MTS machine) from chicken cartilage.  Specifically, they have collected data during a stress-relaxation test from 3 samples of femoral and 3 samples of tibial cartilage, and have generated data seen in the figure below.

1270_Fit the exponential function to the relaxation data.png

            Their cruel, some might say evil, instructor has asked them to determine if the femoral and tibial cartilage are significantly different by analyzing the data with the following exponential equation.

                        L(t) = A e-t/T +B

Where L is the load (y-axis), t is time (x-axis) and A, tau and B are parameters that describe the relaxation.  To finish their analysis, students will have to determine A, tau, and B for each specimen tested (3 femur + 3 tibia).

Your assignment is to write MATLAB code which will allow these poor helpless students to complete their assignments, by using the lsqcurvefit function.

Specifically you will be create 3 functions and 1 script which will:

1. read in the .dat file (including the header information, you already have this code!), with the added feature of being able to load in a 2nd file but remembering previous file's location.

2. plot load (y-axis) versus time (x-axis), and 'remove' prior to reading the minimum, and 60 seconds AFTER reaching the minimum load.

3. Fit the exponential function to the relaxation data and report the filename as well as the A, tau and B values.

4. Run all 3 functions in sequence to analyze ALL data

function_name - denotes a MATLAB function

PSEUDO-CODE functions:

1. ca02_fun1.m: [data import] - reads data from file, plots result

1.1. INPUT:  .dat file name [1xNs string array]

1.2. OUTPUT:  data [Ndx3 numeric array], c_labels [1x3 cell array], filename [1xNs]

1.3. look for figure with 'tag' 'relax-test'

1.4. if does not exist, create it, set 'tag' to 'relax-fit', set 'filename' to '*.dat'

1.5. use nargin, if < 1,

1.6. get old file name from 'filename' field

1.7. prompt user for file (uigetfile)

1.8. create new filename

1.9. set 'filename' to dat_filename for figure

1.10. call new function read_datfile

1.11. plot time (x-axis) vs load (y-axis)

1.12. label axes

2. ca02_fun2.m: [data processing/visualization] - find minimum point, and separate relaxation data

2.1. INPUT:  data (Ndx3 matrix)

2.2. OUTPUT:  data_realx (Nrx3 matrix)

2.3. find row with minimum load value (min)

2.4. determine time at for this row (t_start)

2.5. find last row at t_start + 60;

2.6. create a vector of rows from beginning to end of relaxation data

2.7. export only those rows as variable data_relax

2.8. overlay plot of just the relaxation data

3. ca02_fun3.m:  [least square curve fit] - fit an equation to the data and determine the parameters of the exponential

3.1. INPUT: data_relax [Nx3 numeric matrix]

3.2. OUTPUT:  fit_parameters [1x3 array]

3.3. lookfor object with 'tag' 'relax-fit' (findobj)

3.4. if you can't find it, create the figure with that 'tag'

3.5. make time your x-data (first remove the initial time point)

3.6. make -1*load your y-data

3.7. create inline exponential function 'x(1)*exp(-x_data/x(2))+x(3)','x','x_data'  (this is the function you will be 'fitting'.

3.8. plot time (x-axis) versus load (y-axis)

3.9. initialize x values

3.10. set lower limits

3.11. set upper limits

3.12. run lsqcurvefit get x_fit (fit parameters)

3.13. create an estimate of your y values based on x_fit

3.14. display output in work space (disp)

4. ca02_script.m:  [script to run all programs] - this script combines all programs so you can easily analyze many files.

4.1. Outputs from ca02_fun1, are inputs to ca02_fun2

4.2. outputs from ca02_fun2 are inputs for ca02_fun3

4.3. create a 'formatted' output txt with the following fields

4.4. 'filename (stripped of path), A, tau, B

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M9741029

Have any Question?


Related Questions in MATLAB

Suppose that you have used some concept learning algorithm

Suppose that you have used some concept learning algorithm to learn a hypothesis h1 from some training data. You are interested in knowing the accuracy that the hypothesis can be expected to achieve on the underlying pop ...

Recitation problems -1 determine the highest real root of

Recitation Problems - 1. Determine the highest real root of f(x) = 2x 3 - 11.7x 2 + 17.7x - 5 using the Newton-Raphson method with at least four iterations. Start with an initial guess of x 0 = 3. 2. Determine the real r ...

Assignment -matlab codes and simulated model in

Assignment - Matlab codes and simulated model in simulink/matlab and truetime. 1. Matlab codes and simulink model for pid controller optimization using particle swarm optimization (PSO) my plant is integer order 1000/(s^ ...

Assignment -we have daily gridded rainfall data of 40 years

Assignment - We have daily gridded rainfall data of 40 years and structure of the dataset is like below; Lat = [6.5:0.25:38.5]; Lon = [66.5:0.25:100]; Rainfall (135x129x365x40) (Lon, Lat, days, years). Now, we looking fo ...

What comparison of means test was used to answer the

What comparison of means test was used to answer the question

Assignment matlab programmingusing appropriate matlab

Assignment: MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignmentafter the success of your robo-advice venture you

Assignment After the success of your robo-advice venture you decide to explore alternative sources of profitability for your company. You realize that Australian investors are often forced to chose between expensive acti ...

Discrete optimisation- solve the following two problems

Discrete Optimisation - Solve the following two problems with both exhaustive enumeration and branch and bound - Problem 1 is a mixed integer linear optimisation problem (the problem has both discrete and continuous vari ...

Assignment -data is given on which want to do computational

Assignment - Data is given on which want to do computational production planning using Metaheuristic MATLAB Programming: 1) Ant Colony Algorithm on both Partial and Total Flexible Problem. 2) Bee Algorithm on both Partia ...

Suppose that a student has the option of enrolling for a

Suppose that a student has the option of enrolling for a single elective during a term. The student must select a course from a limited list of options: "English, " "History, " "Biology, " "Computer, " or "Math." Constru ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As