Scaling the values to specific range

조회 수: 5 (최근 30일)
Pat
Pat 2012년 11월 21일
Q=[ 0.0669
0.0383
0.0029
-0.0344
-0.0554
-0.0459
-0.0316
0.0086
0.0392
0.0650
0.0698
0.0478
0.0201
-0.0134
-0.0468
-0.0583
-0.0468
-0.0229
0.0115]
I want to scale the value of Q in range [-(2^13-1),(2^13-1)]
please help
  댓글 수: 6
Walter Roberson
Walter Roberson 2012년 11월 21일
I can't be bothered to research dwt2() to find out what the possible theoretical output ranges are for each possible class of input data. How about if you just state the value ranges and any specific encoding instructions ?
Pat
Pat 2012년 11월 21일
walter these are coefficients from dwt2
S=[ 0.0038
0.0019
0.0105
0.0048
0.0038
-0.0105
-0.0134
-0.0191
-0.0258
-0.0229
-0.0086
-0.0076
-0.0086
-0.0010
0.0038
0.0048
0.0019
-0.0038
-0.0086
-0.0029
0.0038
0.0086
0.0096
0.0124
0.0057
0.0067
-0.0010
0.0029
0.0086
0.0057]
from this i have to sample in that range i.e in 14 bit range .
for 16 bit i have performed
D1=int16(S*32768);please tell how to perform for 14 bit

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

채택된 답변

Harshit
Harshit 2012년 11월 21일
D1=int16(S*32768) maps your any integer S*32768 outside the range to 32768 or for S>1 the output will be 32768(2^15) otherwise it will be round off to the nearest integer(You are assuming maximum non saturating input is 1 beyond this there will be saturation). You can see simply use max(round(2^13*S),2^13). Hope it will be fine.
  댓글 수: 13
Pat
Pat 2012년 11월 21일
ok thanks a lot harshit my final question,i have performed operation on cA,if i am usind idwt2,have i to perform same operation for ch,cV,cD for effictive reconstruction,else performing on cA is enough
Harshit
Harshit 2012년 11월 26일
I will say you to do it because fixed point operations are done similarly.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 11월 21일
Qscaled = 2^13-1;
(Your permitted range consists of exactly one value, so all numbers must scale to that one value.)
  댓글 수: 2
Pat
Pat 2012년 11월 21일
sorry walter it is
[-(2^13-1),(2^13-1)]% a signed 14 bit
Jan
Jan 2012년 11월 21일
편집: Jan 2012년 11월 21일
@Pat: Instead of adding comments, fixing this error by editing the question would be less confusing for the readers. So please fix this.

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

카테고리

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