필터 지우기
필터 지우기

Pythagorean theorem with matrix

조회 수: 7 (최근 30일)
Lewis HC
Lewis HC 2022년 12월 15일
댓글: Voss 2022년 12월 15일
Hi dear friends
I need to create a function called pita (x) that takes an array as its input argument. The matrix AB has two columns, the function must return a column vector C containing values of C that satisfy the Pythagorean theorem A^2+B^2=C^2 for the corresponding row of AB assuming that the two elements of each row of AB correspond to a pair A and B respectively, in the theorem, I have this code:
thank you

채택된 답변

Voss
Voss 2022년 12월 15일
function C = pita(AB)
A = AB(:,1);
B = AB(:,2);
C = sqrt(A.^2+B.^2); % (no transpose)
end
  댓글 수: 2
Lewis HC
Lewis HC 2022년 12월 15일
Thank you friend Voss...you re the best!
Voss
Voss 2022년 12월 15일
You're welcome!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by