フィルターのクリア

hi, i have problem with my program. How do i resolve waverec error? need help

1 回表示 (過去 30 日間)
Yulianto
Yulianto 2022 年 7 月 20 日
回答済み: Pruthvi Charka 2022 年 8 月 25 日
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('db6');
[C,L] = wavedec(ecgsmooth,8,Lo_D,Hi_D);
[d1,d2,d3,d4,d5,d6,d7,d8]=detcoef(C,L,[1,2,3,4,5,6,7,8]);
A8 = wrcoef('a',C,L,Lo_R,Hi_R,8);
A6 = wrcoef('a',C,L,Lo_R,Hi_R,6);
A7 = wrcoef('a',C,L,Lo_R,Hi_R,7);
A5 = wrcoef('a',C,L,Lo_R,Hi_R,5);
A4 = wrcoef('a',C,L,Lo_R,Hi_R,4);
A3 = wrcoef('a',C,L,Lo_R,Hi_R,3);
A2 = wrcoef('a',C,L,Lo_R,Hi_R,2);
A1 = wrcoef('a',C,L,Lo_R,Hi_R,1);
D1 = wrcoef('d',C,L,Lo_R,Hi_R,1);
D2 = wrcoef('d',C,L,Lo_R,Hi_R,2);
D3 = wrcoef('d',C,L,Lo_R,Hi_R,3);
D4 = wrcoef('d',C,L,Lo_R,Hi_R,4);
D5 = wrcoef('d',C,L,Lo_R,Hi_R,5);
D6 = wrcoef('d',C,L,Lo_R,Hi_R,6);
D7 = wrcoef('d',C,L,Lo_R,Hi_R,7);
D8 = wrcoef('d',C,L,Lo_R,Hi_R,8);
[Loo_D,Hii_D,Loo_R,Hii_R] = wfilters('db6');
[C,L] = wavedec(ppgsmooth,8,Loo_D,Hii_D);
[d1,d2,d3,d4,d5,d6,d7,d8]=detcoef(C,L,[1,2,3,4,5,6,7,8]);
A_8 = wrcoef('a',C,L,Loo_R,Hii_R,8);
A_6 = wrcoef('a',C,L,Loo_R,Hii_R,6);
A_7 = wrcoef('a',C,L,Loo_R,Hii_R,7);
A_5 = wrcoef('a',C,L,Loo_R,Hii_R,5);
A_4 = wrcoef('a',C,L,Loo_R,Hii_R,4);
A_3 = wrcoef('a',C,L,Loo_R,Hii_R,3);
A_2 = wrcoef('a',C,L,Loo_R,Hii_R,2);
A_1 = wrcoef('a',C,L,Loo_R,Hii_R,1);
D_1 = wrcoef('d',C,L,Loo_R,Hii_R,1);
D_2 = wrcoef('d',C,L,Loo_R,Hii_R,2);
D_3 = wrcoef('d',C,L,Loo_R,Hii_R,3);
D_4 = wrcoef('d',C,L,Loo_R,Hii_R,4);
D_5 = wrcoef('d',C,L,Loo_R,Hii_R,5);
D_6 = wrcoef('d',C,L,Loo_R,Hii_R,6);
D_7 = wrcoef('d',C,L,Loo_R,Hii_R,7);
D_8 = wrcoef('d',C,L,Loo_R,Hii_R,8);
tr = 'sqtwolog';
thr_D1 = thselect(D1,tr);
thr_D2 = thselect(D2,tr);
thr_D3 = thselect(D3,tr);
thr_D4 = thselect(D4,tr);
thr_D5 = thselect(D5,tr);
thr_D6 = thselect(D6,tr);
thr_D7 = thselect(D7,tr);
thr_D8 = thselect(D8,tr);
tD1 = wthresh(D1,'h',thr_D1);
tD2 = wthresh(D2,'h',thr_D2);
tD3 = wthresh(D3,'h',thr_D3);
tD4 = wthresh(D4,'h',thr_D4);
tD5 = wthresh(D5,'h',thr_D5);
tD6 = wthresh(D6,'h',thr_D6);
tD7 = wthresh(D7,'h',thr_D7);
tD8 = wthresh(D8,'h',thr_D8);
thr_D1_ = thselect(D_1,tr);
thr_D2_ = thselect(D_2,tr);
thr_D3_ = thselect(D_3,tr);
thr_D4_ = thselect(D_4,tr);
thr_D5_ = thselect(D_5,tr);
thr_D6_ = thselect(D_6,tr);
thr_D7_ = thselect(D_7,tr);
thr_D8_ = thselect(D_8,tr);
tD1_ = wthresh(D1,'h',thr_D1_);
tD2_ = wthresh(D2,'h',thr_D2_);
tD3_ = wthresh(D3,'h',thr_D3_);
tD4_ = wthresh(D4,'h',thr_D4_);
tD5_ = wthresh(D5,'h',thr_D5_);
tD6_ = wthresh(D6,'h',thr_D6_);
tD7_ = wthresh(D7,'h',thr_D7_);
tD8_ = wthresh(D8,'h',thr_D8_);
ApECG = A3 - A7;
ECSignal = waverec((ApECG + tD3 + tD4 + tD5 + tD6),8,Lo_R,Hi_R);
ApPPG = A_8;
PPSignal = waverec((ApPPG + tD3_ + tD4_ + tD5_ + tD6_),8,Loo_R,Hii_R);
ERROR
Error using appcoef
Expected N to be a scalar with value <= -1.
Error in appcoef (line 59)
validateattributes(n,{'numeric'},...
Error in waverec (line 23)
x = appcoef(c,l,varargin{:},0);
Error in Ekstraksi (line 84)
ECSignal = waverec((ApECG + tD3 + tD4 + tD5 + tD6),8,Lo_R,Hi_R);

回答 (1 件)

Pruthvi Charka
Pruthvi Charka 2022 年 8 月 25 日
Hi,
I understand that you are trying to use waverec function and encountered an error. The code you have provided is not executable since it contains undefined variables “ecgsmooth” and “ppgsmooth”.
However, it looks like you have passed incorrect value as the second input argument. The waverec function expects bookkeeping vector as the second argument. This vector is used to parse the wavelet coefficients passed in the first argument.
Please refer the waverec function documentation linked below for more details:
Hope this helps!

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by