MATLAB Answers

How to use VPA (variable precision arithmetic) in calculating HH band via dwt on an image?

5 ビュー (過去 30 日間)
Abdul Gaffar
Abdul Gaffar 2019 年 12 月 9 日
編集済み: Stephan 2019 年 12 月 9 日
I have the following code:
img = imread('cameraman.tif');
[LL,LH,HL,HH] = dwt2(img, 'db1');
I have to calculate HH band using vpa (32 digits), instead of double precision.
Plz help in this regard.

  0 件のコメント

サインイン to comment.

採用された回答

Stephan
Stephan 2019 年 12 月 9 日
編集済み: Stephan 2019 年 12 月 9 日
You can not do this. dwt2 accepts only double as input and outputs double. vpa works on symbolic variables and returns a symbolic variable:
>> vpa(pi)
ans =
3.1415926535897932384626433832795
>> whos ans
Name Size Bytes Class Attributes
ans 1x1 8 sym
So you will either get an error if you try to pass a symbolic variable to dwt2 or you will have to cast it to double, which also does not help you. What you can do is show 32 digits of the result calculated as double:
>> a = pi/2
a =
1.5708
>> sprintf('%.32g',a)
ans =
'1.5707963267948965579989817342721'
>> whos
Name Size Bytes Class Attributes
a 1x1 8 double
ans 1x33 66 char
Maybe this helps.

  0 件のコメント

サインイン to comment.

その他の回答 (0 件)

サインイン してこの質問に回答します。


Translated by