Create a MATLAB function that, given a three element vector [x1 x2 x3] as input, calculates r = x1^2 + x2^2 − x3^2.

 Akzeptierte Antwort

Amit
Amit am 31 Jan. 2014

0 Stimmen

function r = myfunc(x)
r = x(:,1).^2 + x(:,2).^2 - x(:,3).^2 ;

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

Ian
am 31 Jan. 2014

Bearbeitet:

am 31 Jan. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by