calculation norm divided by square root of data length

3 visualizaciones (últimos 30 días)
Amanda Kamphoff
Amanda Kamphoff el 10 de Oct. de 2021
Comentada: Jan el 11 de Oct. de 2021
I'm trying to calculate noise level which the formula is already given by book
this is the formula
here I have:
r = [-33.1869365513747 - 7.19942077700726i 9.95754431609273 - 9.07572996519880i 5.11935460162031 - 9.45713125754552i 17.2406749451800 + 7.50738378923969i 22.3786796564404 + 12.6012073987034i -29.1193546016203 + 0.557636320933856i 15.3381897144724 - 3.13336628613266i 30.2746887309409 - 7.75771048053827i];
n = 16;
I tried calculate sd by:
sd=norm(r)/ sqrt(n);
the result of sd = 7.406256475699323
but if I tried calculate sd by
g = norm(r);
h = sqrt(n);
sd = g/ h;
the result would be sd = 67.332259630053100
why is that happend? what's the diffence calculating in those two?
I'm new in Matlab
  3 comentarios
DGM
DGM el 10 de Oct. de 2021
I'm going to assume that something happened to the value of r or n in the intervening code. I don't immediately see how this could happen through any version-dependent behavior or anything.
David Goodmanson
David Goodmanson el 10 de Oct. de 2021
Editada: David Goodmanson el 10 de Oct. de 2021
Hi Amanda,
The number of elements of r is length(r) which is 8, not 16. So this consideration will be part of the calculation as well.

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 10 de Oct. de 2021
Editada: Jan el 10 de Oct. de 2021
r = [-33.1869365513747 - 7.19942077700726i 9.95754431609273 - 9.07572996519880i 5.11935460162031 - 9.45713125754552i 17.2406749451800 + 7.50738378923969i 22.3786796564404 + 12.6012073987034i -29.1193546016203 + 0.557636320933856i 15.3381897144724 - 3.13336628613266i 30.2746887309409 - 7.75771048053827i];
n = 16;
sd1 = norm(r) / sqrt(n)
sd1 = 16.8331
g = norm(r);
h = sqrt(n);
sd2 = g / h
sd2 = 16.8331
For me it works: both give the same result, as expected, but neither 7.4 nor 67.3 .
Did you create a script called "norm" or "sqrt"?
which norm
which sqrt
  2 comentarios
Amanda Kamphoff
Amanda Kamphoff el 11 de Oct. de 2021
Thank you! as your expected I have script called "norm"
Jan
Jan el 11 de Oct. de 2021
Fine. Then the solution is to rename your script, because it shadows the builtin function with the same name.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by