Writing matlab function to go through all the elements of its input
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Let's say I want to make a function for calculating the hypotenuse of a number of triangles with their two dimensions saved as 2 matrices x and y. So I want to make a function such that when I call it in the main terminal it will be [z] = hypotenuse(x,y); such that 'z' will be a matrix containing the hypotenuses of each x,y pair.
How?
0 件のコメント
回答 (3 件)
bym
2011 年 12 月 4 日
doc hypot
1 件のコメント
Paulo Silva
2011 年 12 月 4 日
good one, +1 vote, that documentation got it all nicely, new users should start by reading the documentation first
David Young
2011 年 12 月 4 日
It's just
z = hypot(x, y);
The function automatically operates on all the x,y pairs and returns a matrix of the results.
0 件のコメント
Bidyut
2011 年 12 月 4 日
0 投票
Answer by Mr. David Young is brief and accurate !! Excellent !!
0 件のコメント
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!