Approximate solutions for variables in matrix

3 次查看(过去 30 天)
I'm trying to solve two variables in a linear system to match experiment data. I have a theoretically calculated 4x4 matrix X, which contains two unknown variables s and y. Another 4x4 matrix Data has numbers measured from experiment. Now I need to find the value of s and y that work best for matrix X and Data to be the same. How can i do that?
Also, should I define s and y as symbolic variables in matrix calculation?
Thanks!
  1 个评论
Roger Stafford
Roger Stafford 2016-4-27
Your description would indicate that you have four equalities to satisfy, (at least approximately.) Since four equations is more than two unknowns, you will in general be unable to find an exact solution. What are you looking for as a measure of the quality of an approximation - the least mean square among the four differences, for example?

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2016-4-27
Your system might be linear, but it might depend on s and y in nonlinear ways. For example, a 4 x 4 rotation matrix is a linear system in itself, but it relies upon three angles in non-linear ways, and there is no way of uniquely recovering the angles from the final rotation matrix.
We therefore need to know more about the system to determine the difficulty of this.
  1 个评论
Amy Zou
Amy Zou 2016-4-27
Oh yes, you are right. s and y are in some nonlinear functions. I was doing Johns matrix calculation for a SLM. s and y are the vertical retardation angle and rotation angle respectively. So there are sinusoidal function and exponential involved.

请先登录,再进行评论。

更多回答(1 个)

John D'Errico
John D'Errico 2016-4-27
If I read you properly, you are trying to solve the problem
X(s,y) = data
where data is a 4x4 matrix, and X is also a 4x4 matrix, effectively a function of s and y, so each element X(i,j) is a nonlinear function of the parameters s and y.
Just solve this as a nonlinear least squares problem. Use lsqnonlin, or lsqcurvefit, from the optimization toolbox. Do NOT make the parameters symbolic. Just set up a function handle for X(s,y), that can generate the matrix X for any give pair of parameters s and y.
If X is a function of two arguments s and y, then convert it to a function of a vector of length 2, as below:
Xfun = @(sy) X(sy(1),sy(2));
Then call lsqcurvefit.

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by