필터 지우기
필터 지우기

Anyone know what is the function of matlab to find answer of my question?

조회 수: 2 (최근 30일)
i have a matrix g=[a;b] and how can i calculate m=sqrt(a^2 + b^2)? i need to write this function in such a while loop.

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 31일

추가 답변 (1개)

Image Analyst
Image Analyst 2013년 4월 1일
Alternatively, but a little more complicated:
m = hypot(g(1), g(2));
Not sure why you need it to be in a while loop, but if you do, and a and b are row vectors
k = 1
while k <= size(g, 2)
a = g(1, k);
b = g(2, k);
m(k) = hypot(a, b);
k = k + 1;
end

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by