lwtcoef
Extract or reconstruct 1-D LWT wavelet coefficients and orthogonal projections
Since R2021a
Description
specifies options using one or more name-value arguments. For example, y
= lwtcoef(ca
,cd
,Name,Value
)y =
lwtcoef(ca,cd,'OutputType','coefficients')
specifies coefficients
output.
Examples
Reconstruct Signal from Orthogonal Projections
Load a 1-D signal of length 2048. Plot the signal.
load wecg plot(wecg) title('Signal') ylabel('Amplitude') axis tight
Create a lifting scheme associated with the db4
wavelet. Use the lifting scheme to obtain the wavelet decomposition of the signal to the maximum level. Confirm the length of the detail coefficients cell array equals floor(log2(N))
, where N is the length of the signal.
wv = 'db4'; lsc = liftingScheme('Wavelet',wv); [ca,cd] = lwt(wecg,'LiftingScheme',lsc); [length(cd) floor(log2(length(wecg)))]
ans = 1×2
11 11
Extract and plot the approximation coefficients at level 3. Confirm the length of the extraction is one-eighth the length of the original signal.
approxCf = lwtcoef(ca,cd,'LiftingScheme',lsc, ... 'OutputType','coefficients', ... 'Level',3); [2048/(2^3) length(approxCf)]
ans = 1×2
256 256
plot(approxCf) title('Level 3 Approximation Coefficients') ylabel('Amplitude') axis tight
Obtain the orthogonal projection of the level 3 approximation coefficients. Also obtain the orthogonal projections of the detail coefficients at levels 1, 2, and 3. Plot the results.
approx3 = lwtcoef(ca,cd,'LiftingScheme',lsc, ... 'OutputType','projection','Level',3); det3 = lwtcoef(ca,cd,'LiftingScheme',lsc, ... 'OutputType','projection','Level',3,'Type','detail'); det2 = lwtcoef(ca,cd,'LiftingScheme',lsc, ... 'OutputType','projection','Level',2,'Type','detail'); det1 = lwtcoef(ca,cd,'LiftingScheme',lsc, ... 'OutputType','projection','Level',1,'Type','detail'); tiledlayout(4,1) nexttile plot(approx3) title('Projection - Approximation') axis tight nexttile plot(det3) title('Projection - Level 3 Details') axis tight nexttile plot(det2) title('Projection - Level 2 Details') axis tight nexttile plot(det1) title('Projection - Level 1 Details') axis tight
Confirm the sum of the four projections equals the original signal.
max(abs(wecg-(approx3+det3+det2+det1)))
ans = 1.3323e-15
Input Arguments
ca
— Approximation coefficients
scalar | vector | matrix
Approximation (lowpass) coefficients at the coarsest level, specified as a
scalar, vector, or matrix. The coefficients are the output of lwt
.
Data Types: single
| double
Complex Number Support: Yes
cd
— Detail coefficients
cell array
Detail coefficients, specified as an L-by-1 cell array,
where L is the level of the transform. The elements of
cd
are in order of decreasing resolution. The
coefficients are the output of lwt
.
Data Types: single
| double
Complex Number Support: Yes
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: y =
lwtcoef(ca,cd,'LiftingScheme',lsc,'OutputType','coefficients','Level',2)
uses the lifting scheme lsc
to extract the approximation
coefficients at level 2.
Wavelet
— Wavelet
'db1'
(default) | character vector | string scalar
Orthogonal or biorthogonal wavelet, specified as a character vector or
string scalar. See the Wavelet property of liftingScheme
for
the list of supported wavelets. For perfect reconstruction, the
specified wavelet must match the wavelet you used to generate
ca
and cd
.
You cannot specify 'Wavelet'
and
'LiftingScheme'
name-value arguments at the same
time.
LiftingScheme
— Lifting scheme
liftingScheme
object
Lifting scheme to use, specified as a liftingScheme
object. For perfect reconstruction, the
specified lifting scheme must match the lifting scheme you used to
generate ca
and cd
.
You cannot specify 'Wavelet'
and
'LiftingScheme'
name-value arguments at the same
time.
OutputType
— Output type
'coefficients'
(default) | 'projection'
Output type, specified as one of:
'coefficients'
— Extract the approximation or details coefficients'projection'
— Return the projection (reconstruction) of the approximation or details coefficients
Example: y =
lwtcoef(ca,cd,'OutputType','projection','Type','detail')
returns the projection corresponding to the detail coefficients at the
finest scale.
Type
— Type of coefficients
'approximation'
(default) | 'detail'
Type of coefficients to extract or reconstruct, specified as
'approximation'
or
'detail'
.
Example: y = lwtcoef(ca,cd,'Type','detail')
extracts
the detail coefficients at the finest scale.
Level
— Level
1
(default) | integer
Level of coefficients to extract or reconstruct, specified as an
integer in the range [1,N]
, where
N is the length of
cd
.
Example: y =
lwtcoef(ca,cd,'LiftingScheme',lsc,'Level',3)
uses the
lifting scheme lsc
to extract the approximation
coefficients at level 3.
Data Types: double
Int2Int
— Handling integer-valued data
false
or
0
(default) | true
or 1
Extension
— Extension mode
"periodic"
(default) | "zeropad"
| "symmetric"
Extension mode to use to extract or reconstruct the coefficients, specified as one of these:
"periodic"
— Periodized extension"zeropad"
— Zero extension"symmetric"
— Symmetric extension
This argument specifies how to extend the signal at the
boundaries. The extension mode must match the value you used to generate
ca
and cd
.
Example: y = lwtcoef(ca,cd,Extension="zeropad")
specifies zero extension.
Output Arguments
y
— Extracted coefficients or projection
vector | matrix
Extracted coefficients or projection, returned as a vector or matrix. If
ca
is a scalar or vector, and the elements of
cd
are vectors, then y
is a
vector. If ca
and the elements of
cd
are matrices, then y
is a
matrix, where each column is the extraction or projection of the
corresponding columns in ca
and
cd
.
Data Types: single
| double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2021aR2021a: lwtcoef
input syntax has changed
The lwtcoef
input syntax has changed. Use name-value
arguments instead.
Functionality | Result | Use Instead | Compatibility Considerations |
---|---|---|---|
Y =
lwtcoef(TYPE,XDEC,LS,LEVEL,LEVEXT) | Errors |
| According to the value of
|
See Also
lwt
| ilwt
| liftingScheme
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)