Filter löschen
Filter löschen

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

5 Ansichten (letzte 30 Tage)
Jack Hogan
Jack Hogan am 15 Nov. 2022
Bearbeitet: Akash am 31 Aug. 2023
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.

Antworten (1)

Akash
Akash am 31 Aug. 2023
Bearbeitet: Akash am 31 Aug. 2023
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.

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by