calculation norm divided by square root of data length

조회 수: 1 (최근 30일)
Amanda Kamphoff
Amanda Kamphoff 2021년 10월 10일
댓글: Jan 2021년 10월 11일
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
DGM
DGM 2021년 10월 10일
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 2021년 10월 10일
편집: David Goodmanson 2021년 10월 10일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2021년 10월 10일
편집: Jan 2021년 10월 10일
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
Amanda Kamphoff
Amanda Kamphoff 2021년 10월 11일
Thank you! as your expected I have script called "norm"
Jan
Jan 2021년 10월 11일
Fine. Then the solution is to rename your script, because it shadows the builtin function with the same name.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by