Filter löschen
Filter löschen

Pythagorean theorem with matrix

7 Ansichten (letzte 30 Tage)
Lewis HC
Lewis HC am 15 Dez. 2022
Kommentiert: Voss am 15 Dez. 2022
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

Akzeptierte Antwort

Voss
Voss am 15 Dez. 2022
function C = pita(AB)
A = AB(:,1);
B = AB(:,2);
C = sqrt(A.^2+B.^2); % (no transpose)
end
  2 Kommentare
Lewis HC
Lewis HC am 15 Dez. 2022
Thank you friend Voss...you re the best!
Voss
Voss am 15 Dez. 2022
You're welcome!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by