Three element vector function?

8 views (last 30 days)
Ian
Ian on 31 Jan 2014
Edited: Walter Roberson on 31 Jan 2014
Create a MATLAB function that, given a three element vector [x1 x2 x3] as input, calculates r = x1^2 + x2^2 − x3^2.

Accepted Answer

Amit
Amit on 31 Jan 2014
function r = myfunc(x)
r = x(:,1).^2 + x(:,2).^2 - x(:,3).^2 ;

More Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!