How to use a least square fit to find tensor coefficients of a polynomial

6 次查看(过去 30 天)
I have a table of data with x1, x2, X1, and X2, where displacements u1 and u2 are given by u1 = X1 - x1 and u2 = X2 - x2. I need to use this data to find the coefficients of the deformation equation given by :
a is a vector, A is a second order matrix, and B is a third order matrix, I'm trying to use MATLAB to help me find these coefficients but I'm not very experienced in MATLAB and I'm not sure if there is a method to find coeficients like this that aren't all scalars. It's been suggested to me to use least square fit to do so but I'm unfamiliar with the concept. Can someone suggest a solution? Thanks.

回答(1 个)

Akash
Akash 2023-8-31
编辑:Akash 2023-8-31
Hi Jack Hogan,
I understand that you have a table of data and you need to determine the coefficients for the given equation. You have been suggested to use the least square fit. As, you have not defined about “X_j” and “X_k”, I am assuming “X_k” = transpose(“X_j”).
Firstly, it's important to note that methods like “polyfit” and “lsqcurvefit” functions are commonly used for fitting data, but they typically return scalar coefficients rather than matrices. “polyfit” is widely used for performing the fitting but the input “X” and output “Y” should have same size while using “polyfit(X, Y, n)” where “n” is the degree of polynomial. “lsqcurvefit” is used to solve nonlinear data fitting problems in least square sense. you can look into some examples to get some more help. The link to the documentation of the functions and examples are provided below.
I would suggest you that if your aim is to solve the expression and extracting coefficient values are not your aim then you can use system of linear equation by taking the coefficients as unknowns. You may need to rearrange the expression to do so. “lsqr” will be able to help you perform the operation in MATLAB. The link to the documentation is provided below.
However, if you specifically require matrix coefficients, it would be helpful to have more information about the structure and requirements of the deformation equation. However, you may create your own “polyfit” function to perform your process. This link will help you with the steps to create your own function for the fitting.
I suggest looking into the resources, such as “polyfit”, “lsqcurvefit”, and “lsqr”, as they can provide further insights and examples to help you understand and implement the least square fitting concept in MATLAB.

类别

Help CenterFile Exchange 中查找有关 Least Squares 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by