필터 지우기
필터 지우기

matrix dimension error. i can understand why it is showing but cannot get any solution

조회 수: 2 (최근 30일)
i have A1 which 2x2 matrix and B1 which 2x1 matrix. i have a system
A1*Y=B1.
i wish to solve it by
Y = A1/B1;
but it shows
error matrix dimension must agree.
i can understand why it is showing like this, but how to solve this problem?
A1 = [x1,(r11*X1+r12*Y1+r13*Z1+Tx);x2,(r11*X2+r12*Y2+r13*Z2+Tx)];
B1 = [-x1*(r31*X1+r32*Y1+r33*Z1);-x2*(r31*X2+r32*Y2+r33*Z2)];
Y = A1/B1;
disp(Y);
please let me know

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 15일
Are you sure you want A1/B1 and not A1\B1 ?
  댓글 수: 1
Sat m
Sat m 2013년 3월 15일
thank you. i am sorry it was my mistake that i did A1/B1 instead of A1\B1. i did not know the difference between / and \ in case of inverse....thank you

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

추가 답변 (1개)

Youssef  Khmou
Youssef Khmou 2013년 3월 15일
편집: Youssef Khmou 2013년 3월 15일
hi, you can try :
% given A AND B
A=rand(2);
B=rand(2,1);
%1) solution 1: A^-1
X1=inv(A)*B;
%2) solution 2 : Pseudo inverse
X2=pinv(A)*B;
%3) solution 3 : leastt squares
X3=inv(A'*A)*A'*B;
%4) solution A\B
X4=A\B;

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by