Question
Write a function to obtain the CTE in a single direction by performing a least squares regression on a single set of lattice parameter and
Write a function to obtain the CTE in a single direction by performing a least squares regression on a single set of lattice parameter and temperature data. Use a system of equations (not a built in MATLAB function) to determine the coefficients of the regression.
Name your function linReg and write it to take 2 inputs
o T- a vector of temperature values (C)
o l- a vector of lattice parameter values (nm)
Your function should have 3 outputs
o alpha- the coefficient of thermal expansion (nm/oC)
o d- the constant from the regression equation o Rsq- the R2 value for the regression
how to write the code in matlab
In material science and civil engineering, it is useful to know the coefficient of thermal expansion (CTE) of a material in order to understand how a material behaves in changing temperatures. A civil engineer is considering using a new steel alloy, Spartanium, for construction of part of the facility for rare isotope beams (FRIB) on campus but needs to evaluate the CTE of Spartanium before deciding to use it in the FRIB. The lattice parameters of Spartanium, which are the distances between planes of atoms within the material, have been measured in all three dimensions as a function of temperature. One set of lattice parameter and temperature data can be used to evaluate the CTE in one direction using the following expression: Where l is the lattice parameter (nm), T is the temperature (C), d is a constant, and is the CTE (nm/C). Spartanium is known to be an orthorhombic crystal which means that on an atomic scale, the alloy looks like: 2 2 Where , ly, and / are the lattice parameters in the x, y, and z directions, respectively. From the equation above, which is of the linear form y-mx+b, it can be seen that performing a linear regression on the collected data will obtain Ax, ay, and 2, the CTEs in the x, y, and z directions. In material science and civil engineering, it is useful to know the coefficient of thermal expansion (CTE) of a material in order to understand how a material behaves in changing temperatures. A civil engineer is considering using a new steel alloy, Spartanium, for construction of part of the facility for rare isotope beams (FRIB) on campus but needs to evaluate the CTE of Spartanium before deciding to use it in the FRIB. The lattice parameters of Spartanium, which are the distances between planes of atoms within the material, have been measured in all three dimensions as a function of temperature. One set of lattice parameter and temperature data can be used to evaluate the CTE in one direction using the following expression: Where l is the lattice parameter (nm), T is the temperature (C), d is a constant, and is the CTE (nm/C). Spartanium is known to be an orthorhombic crystal which means that on an atomic scale, the alloy looks like: 2 2 Where , ly, and / are the lattice parameters in the x, y, and z directions, respectively. From the equation above, which is of the linear form y-mx+b, it can be seen that performing a linear regression on the collected data will obtain Ax, ay, and 2, the CTEs in the x, y, and z directionsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started