フィルターのクリア

Discrete Wavelet analysis code problem

3 ビュー (過去 30 日間)
Sebsatien
Sebsatien 2015 年 11 月 23 日
回答済み: Walter Roberson 2015 年 11 月 24 日
Hi
So, I'm trying to code a program that computes and displays the Discrete wavelet analysis over a certain number of levels of an imported signal using the wavedec function. But I have a problem running it so far since I've got these 2 errors :
Error using appcoef (line 39)
Invalid level value.
Error in Ondelette (line 12)
ap4=appcoef(c,1,'db2',4);
The code is as shown below :
clear all ;
close all ;
clc ;
s = dlmread('I1V1500.txt','\t');
whos
sig = s ;
longsig=length(sig);
[c.l]=wavedec(sig,4,'db2');
ap4=appcoef(c,1,'db2',4);
ap3=appcoef(c,1,'db2',3);
ap2=appcoef(c,1,'db2',2);
ap1=appcoef(c,1,'db2',1);
d4=detcoef(c,l,4);
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,1,1);
figure ;
subplot(5.2,1);plot(sig);
I've also joined the imported file in question.
I'd be grateful if someone could help me solve my problem.
Thanks in advance
  1 件のコメント
Sebsatien
Sebsatien 2015 年 11 月 24 日
Any help please ?

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 11 月 24 日
[c.l]=wavedec(sig,4,'db2');
should be
[c, L]=wavedec(sig,4,'db2');
You were accidentally outputting to a structure field instead of to two different variables.
And
ap4=appcoef(c,1,'db2',4);
ap3=appcoef(c,1,'db2',3);
ap2=appcoef(c,1,'db2',2);
ap1=appcoef(c,1,'db2',1);
should be
ap4=appcoef(c,L,'db2',4);
ap3=appcoef(c,L,'db2',3);
ap2=appcoef(c,L,'db2',2);
ap1=appcoef(c,L,'db2',1);
You were passing in the digit 1 instead of the letter lower-case L.

カテゴリ

Help Center および File ExchangeDiscrete Multiresolution Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by