Error using ilwt Expected LEVEL to be a scalar with value <= 1.

3 views (last 30 days)
[ca,cd] = lwt(x1,'LiftingScheme',lsc,'Level',2,'Int2Int',true);
...working on ca
x11 = ilwt(double(CA), cd, 'LiftingScheme',lsc,'Int2Int',true,'Level',2);
Error using ilwt
Expected LEVEL to be a scalar with value <= 1.
Error in ilwt>ilwtParser (line 339)
validateattributes(level, {'numeric'},...
Error in ilwt (line 82)
[LS,ext,level,~,isI2I] = ilwtParser(lvl,varargin{:});

Answers (1)

Umeshraja
Umeshraja on 19 Sep 2024
It seems you're encountering an error while using the 'ilwt' function for the Inverse Lifting Wavelet Transform. The issue arises because the 'Level' argument in the 'ilwt’ function must be a non-negative integer less than or equal to length(cd) - 1 where ‘cd’ is the ‘Detail coefficients’. length of ‘cd’ is Lx1 where ‘L’ is the ‘Level’ mentioned in 'lwt' function.
Below is a demonstration of how to perform these arguments correctly
% Define the input data
x1 = 1:100;
% Create a lifting scheme using the 'db3' wavelet
lsc = liftingScheme('Wavelet', 'db3');
% Perform the Lifting Wavelet Transform on the data
% 'Level' is set to 5
[ca, cd] = lwt(x1, 'LiftingScheme', lsc, 'Level', 5, 'Int2Int', true);
% Display the length of the detail coefficients (cd)
disp(['Length of cd: ', num2str(length(cd))]);
Length of cd: 5
% Perform the Inverse Lifting Wavelet Transform (ILWT)
% 'Level' is set to 4, which must be <= length(cd) - 1
x11 = ilwt(double(ca), cd, 'LiftingScheme', lsc, 'Int2Int', true, 'Level', 4);
% Display the reconstructed data
disp('Reconstructed data using ILWT:');
Reconstructed data using ILWT:
disp(x11');
2 4 6 8 11 12 6
For more information on the ‘lwt’ and ‘ilwt’ functions, please refer to these MATLAB R2021b documentation links:
Hope it resolves your issue!

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!