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
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!