필터 지우기
필터 지우기

Discrete Wavelet analysis code problem

조회 수: 2 (최근 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개)

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 CenterFile Exchange에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by