how to calculate transformation matrix x=A*y

조회 수: 6 (최근 30일)
Immelmann
Immelmann 2015년 11월 10일
댓글: Star Strider 2015년 11월 10일
hello,
I'm embarrassed but I can not find a way to calculate a transformation matrix in the form: x=A*y (x-vector rank(n), y-vector rank(n), A-matrix rank(nxn)) I could create symbolic A and solve every row manually, but there must be a simple command for such a simple operation.

채택된 답변

Star Strider
Star Strider 2015년 11월 10일
I would use the pinv function (although I’ll likely hear about it!):
% x=A*y —> Create ‘A’:
x = randi(9, 5, 1);
y = randi(9, 5, 1);
A = x*pinv(y);
xc = A*y; % Check

추가 답변 (1개)

Immelmann
Immelmann 2015년 11월 10일
Thank you. It works and I will certainly make use of pinv function. But for my current special problem I look for a matrix A (as below) with coefficients "+-1" or "0" (which is always possible in my case). Is there a way to force matlab use only certain matrix entries?
A
[1 0 1;...
0 0 -1;...
0 1 0]
  댓글 수: 1
Star Strider
Star Strider 2015년 11월 10일
My pleasure.
I never needed to do that, so I can only guess that the way to do it might be using a constrained optimisation routine (Optimization Toolbox) or perhaps using a genetic algorithm (Global Optimization Toolbox).
I would personally go for the genetic algorithm because I have more experience with them. They are also free of gradient descent constraints, and are free to roam your solution space to find appropriate results. You can constrain them if necessary as your requirements dictate. If you don’t have the Global Optimization Toolbox, unconstrained genetic algorithms are also easy to write. In this instance, your ‘population’ are ‘individuals’ (vectors) with trinary ‘states’ {-1,0,+1} that you can then form into matrices (use the reshape function) to test in your fitness function. Since you already know ‘x’ and ‘y’, your fitness function would be to minimise norm(x-A*y), with ‘A’ being each of your ‘individual’ or ‘chromosome’ vectors reshaped into an appropriate-sized matrix.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by