Clear Filters
Clear Filters

Approximate solutions for variables in matrix

3 views (last 30 days)
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 Comment
Roger Stafford
Roger Stafford on 27 Apr 2016
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?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 27 Apr 2016
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 Comment
Amy Zou
Amy Zou on 27 Apr 2016
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.

Sign in to comment.

More Answers (1)

John D'Errico
John D'Errico on 27 Apr 2016
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.

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!