Filter löschen
Filter löschen

what is the meaning of this instruction?

1 Ansicht (letzte 30 Tage)
lotus
lotus am 22 Mär. 2013
y = -Inf*ones(size(x))

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 22 Mär. 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 Kommentar
lotus
lotus am 22 Mär. 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?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by