wfbm function wierdly crashes for a range of hurst exponent
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
vanni meier
am 29 Okt. 2023
Beantwortet: Walter Roberson
am 30 Okt. 2023
The function wfbm(H,L) used to generate a fractional brownian signal returns an error for H
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1524481/image.png)
H = 0.49;
L=200;
Brownian_signal = wfbm(H,L);
Returns an error inside wfbm itself.
Error using idwt
Lowpass (scaling) and highpass (wavelet) filters must be the same length and
must have an even number of samples.
Error in wfbm (line 145)
CA = idwt(CA,CD,fs1,gs1,len);
However it works fine for H={0.01 0.02 .... 0.48} soo any idea?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 30 Okt. 2023
H-(1/2) is passed to an internal function named alphacfs .
In that function
I = 1:1000;
cka = gamma(alpha+1)./(gamma(I).*gamma(alpha+2-I));
is calculated, and then find() is done to locate positions where abs(cka) <= 1e-4 . The beginning part of cka up to there is extracted and returned.
When H is in the range you indicate, it happens that the matching first location is at index 107, which is odd. When H is smaller then the first matching location is even. (The sign of the cka entries alternate.)
The returned coefficients are then conv() with something of length 20. When the coefficient length is 107 that gives a result of length 126. But the result of that is conv() again with something of length 2, which gives an final length of 127.
Then later the code checks to see whether the number of coefficients is odd or even, and finds that 127 is odd, and gives the error message.
The internal documentation implies that the code expects to work with H up to 1-eps but clearly it is not doing so.
I would say this is an internal bug that you should report.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Filter Banks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!