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
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
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
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.
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.
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.
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 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 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
Extension mode to use to extract or reconstruct the coefficients, specified as one of these:
"periodic"
— Periodized extension"zeropad"
— Zero padding"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 padding.
Output Arguments
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 R2021aThe 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 Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)