Borrar filtros
Borrar filtros

Discrete Wavelet analysis code problem

2 visualizaciones (últimos 30 días)
Sebsatien
Sebsatien el 23 de Nov. de 2015
Respondida: Walter Roberson el 24 de Nov. de 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

Respuestas (1)

Walter Roberson
Walter Roberson el 24 de Nov. de 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.

Categorías

Más información sobre Discrete Multiresolution Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by