Azzera filtri
Azzera filtri

what is the meaning of this instruction?

1 visualizzazione (ultimi 30 giorni)
y = -Inf*ones(size(x))

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 22 Mar 2013
x=[1 2;3 4;5 6]
size(x)
ans =
3 2 % 3 lines and 2 columns
ones(size(x)) % create 3x2 array with 1
ans =
1 1
1 1
1 1
-inf*ones(size(x))
ans =
-Inf -Inf
-Inf -Inf
-Inf -Inf
  1 Commento
lotus
lotus il 22 Mar 2013
i understand your example.thank you.but,if the code is like below:
ptotdB = dbp(ptot);
in another file:
function y=dbp(x)
y = -Inf*ones(size(x));
nonzero = x~=0;
y(nonzero) = 10*log10(abs(x(nonzero)));
i don't understand this whole code.can you explain it in the simplest way?

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by