How does Matlab divide two row vectors by each other to get a scalar?

조회 수: 25 (최근 30일)
Let's consider, A is a vector like shown:
A = [20 30 40];
and B is also a vector:
B = [5 10 20];
when you want to execute this operation:
C = B/A;
then you will get a scalar: 0.4137
if you want to check this answer by doing this:
C.*A
It should be got B again but you will get this vector instead:
ans =
8.2759 12.4138 16.5517
Could somebody explain what's going on?
  댓글 수: 4
Stephen23
Stephen23 2019년 10월 16일
"It should be got B again"
Can you show us the system of equations for which this statement is true?
Osama Tabbakh
Osama Tabbakh 2019년 10월 16일
I was just an example for understanding how calculate matlab this scalar 0.4137 and why it is scalar.

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

채택된 답변

Star Strider
Star Strider 2019년 10월 16일
To expand slightly on that, ‘C’ is the least-squares estimate of the slope of with the y-intercept forced through the origin:
figure
plot(A,B,'p', A,C*A,'-r', [0 A(1)],C*[0 A(1)],':k')
axis([0 45 0 25])
  댓글 수: 6
Timo Tommila
Timo Tommila 2020년 10월 8일
편집: Timo Tommila 2020년 10월 8일
awesome, thank you I was wondering the same thing.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by