how can i pass a vector to a function?

18 次查看(过去 30 天)
i have a function which has 2 variables each of these variables are a vector. how do i pass vector inputs to the function???

采纳的回答

Birdman
Birdman 2018-2-8
function z=f(x,y)
z=x.^2+y.^2;
end
From command line, type
x=[1;2];y=[3;4]
z=f(x,y)
and the result would be
[10;20]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surfaces, Volumes, and Polygons 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by