what is the meaning of this instruction?

5 views (last 30 days)
y = -Inf*ones(size(x))

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 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 Comment
lotus
lotus on 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?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!