필터 지우기
필터 지우기

describing code (for loop)

조회 수: 2 (최근 30일)
ahmad ramadan
ahmad ramadan 2018년 10월 18일
댓글: madhan ravi 2018년 10월 18일
can you describe the code below
function [Y] = mu_law_expander(Xq,u)
for n = 1:numel(Xq)
disp(n);
Y(n) = ((-1 + (1+u)^abs(Xq(n))) / u) * sign(Xq(n));
end
%%

답변 (1개)

madhan ravi
madhan ravi 2018년 10월 18일
편집: madhan ravi 2018년 10월 18일
Xq is a vector , u is a scalar
the loop runs from 1 to the number of elements of Xq
number of iteration is displayed which is n here
and then the value is calculated according to the given formula
abs() considers Xq value as positive even if the value is negative and sign() returns 1 if the value is greater than zero and zero otherwise are matlab's inbuilt function
that's it
  댓글 수: 1
madhan ravi
madhan ravi 2018년 10월 18일
if something is not clear let know else accept the answer

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by