Ask an expert. Trust the answer.

Your academic and career questions answered by verified experts

Matlab, operator A\B

Date: 2022-08-01 11:30:51

What is the result of the operation A\B, where A(1, m) and B (1, m)?

In the manual it is written:

A\B returns a least-squares solution to the system of equations A*x= B.

So it means x = inv (A'*A)*A'*B? However, the matrix A'*A is singular...

Let us suppose: 

 

A=[1 2 3]
B=[6 7 6]
A\B

0         0         0
0         0         0
2.0000    2.3333    2.0000
If ve use MLS:

C = inv (A'*A)   singular matrix
C = pinv(A'*A)

0.0051    0.0102    0.0153
0.0102    0.0204    0.0306
0.0153    0.0306    0.0459

D= C*A'*B

0.4286    0.5000    0.4286
0.8571    1.0000    0.8571
1.2857    1.5000    1.2857 

So results A\B and inv (A'*A)*A'*B are different... 

Expert Answer:

s: 

My MATLAB (R2010b) says quite a lot about what A\B does: 

mldivide(A,B) and the equivalent A\B perform matrix left division (back slash). A and B must be matrices that have the same number of rows, unless A is a scalar, in which case A\B performs element-wise division — that is, A\B = A.\B.

If A is a square matrix, A\B is roughly the same as inv(A)*B, except it is computed in a different way. If A is an n-by-n matrix and B is a column vector with n elements, or a matrix with several such columns, then X = A\B is the solution to the equation AX = B. A warning message is displayed if A is badly scaled or nearly singular.

If A is an m-by-n matrix with m ~= n and B is a column vector with m components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations AX = B. In other words, X minimizes norm(A*X - B), the length of the vector AX - B. The rank k of A is determined from the QR decomposition with column pivoting. The computed solution X has at most k nonzero elements per column. If k < n, this is usually not the same solution as x = pinv(A)*B, which returns a least squares solution.

mrdivide(B,A) and the equivalent B/A perform matrix right division (forward slash). B and A must have the same number of columns.

If A is a square matrix, B/A is roughly the same as B*inv(A). If A is an n-by-n matrix and B is a row vector with n elements, or a matrix with several such rows, then X = B/A is the solution to the equation XA = B computed by Gaussian elimination with partial pivoting. A warning message is displayed if A is badly scaled or nearly singular.

If B is an m-by-n matrix with m ~= n and A is a column vector with m components, or a matrix with several such columns, then X = B/A is the solution in the least squares sense to the under- or overdetermined system of equations XA =

Why Matlabhelpers ?

Looking for reliable MATLAB assignment help? Our expert MATLAB tutors deliver high-quality, easy-to-understand solutions tailored to your academic needs. Whether you're studying at Monash University, the University of Sydney, UNSW, or the University of Melbourne, we provide trusted MATLAB assistance to help you excel. Contact us today for the best MATLAB solutions online and achieve academic success!

MATLAB Assignment Help Services

Personalized Tutoring: Get one-on-one guidance from our MATLAB experts. Whether you're tackling basic concepts or advanced algorithms, we provide clear, step-by-step explanations to help you master MATLAB with confidence.

Assignment Assistance: Struggling with tight deadlines or complex assignments? Our team offers end-to-end support, from problem analysis to code development and debugging, ensuring your assignments meet the highest academic standards.

Project Development: Need expert help with your MATLAB research project? We assist in designing and implementing robust solutions, covering project planning, data collection, coding, simulation, and result analysis.

Coursework Support: Enhance your understanding of MATLAB with our comprehensive coursework assistance. We help you grasp lecture concepts, complete lab exercises, and prepare effectively for exams.

Thesis and Dissertation Guidance: Incorporate MATLAB seamlessly into your thesis or dissertation. Our experts provide support for data analysis, modeling, and simulation, ensuring your research is methodologically sound and impactful.

Contact us on WhatsApp for MATLAB help

Contact us on Telegram for MATLAB solutions