Effacer les filtres
Effacer les filtres

describing code (for loop)

2 vues (au cours des 30 derniers jours)
ahmad ramadan
ahmad ramadan le 18 Oct 2018
Commenté : madhan ravi le 18 Oct 2018
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
%%

Réponses (1)

madhan ravi
madhan ravi le 18 Oct 2018
Modifié(e) : madhan ravi le 18 Oct 2018
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 commentaire
madhan ravi
madhan ravi le 18 Oct 2018
if something is not clear let know else accept the answer

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by