Effacer les filtres
Effacer les filtres

Discrete Wavelet analysis code problem

2 vues (au cours des 30 derniers jours)
Sebsatien
Sebsatien le 23 Nov 2015
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 commentaire
Sebsatien
Sebsatien le 24 Nov 2015
Any help please ?

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 24 Nov 2015
[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.

Catégories

En savoir plus sur Discrete Multiresolution Analysis dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by