채택된 답변

Star Strider
Star Strider 2014년 7월 8일

0 개 추천

You just did — almost.
x = 0.5;
dB = 20*log10(x);
produces:
dB =
-6.0206e+000

댓글 수: 8

Undefined function 'log' for input arguments of type 'uint8'.
Error in signaltonoise (line 17)
20*log(10,a1);
i am getting this error in my code
Image Analyst
Image Analyst 2014년 7월 8일
Cast the badly-named "a1" to a double if that's what it wants.
seshi reddy
seshi reddy 2014년 7월 8일
i did not get you, what do you mean by a double??
seshi reddy
seshi reddy 2014년 7월 8일
looking forward for your reply sir
ans = 20*log10(double(a1));
seshi reddy
seshi reddy 2014년 7월 8일
oh ok thank you so much, but when i was doing in the command window i was getting the answer, can you explain me why is it happening like that. dont mind that if these are stupid questions, i am asking because i am new to this software
Star Strider
Star Strider 2014년 7월 8일
My pleasure!
You should have gotten the same result in your script as with the Command Window if you entered the same commands, unless you somehow implicitly converted a1 to double before you issued your Command Window call to log10. That’s the only way I can explain it.
No questions are stupid questions. No worries.
seshi reddy
seshi reddy 2014년 7월 8일
yeah got it thank you so much

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2014년 7월 8일

댓글:

2014년 7월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by