This also shows that there is a significant difference for sym4. In the above case, for the same data, I got the SNR to be 9.6994 and 9.4954 for sym4 and db1 wavelets. This example has been derived from the MATLAB example. #Wavelet denoise codeWavelet reconstructions based on the level-4 approximation (Image by author) Complete MATLAB code clear close clc wdir='./' fileloc0= fileloc_ext = '.mat' fileloc = if exist(fileloc,'file') disp() load(fileloc) all_stats = fieldnames(stats) all_data = fieldnames(data) for id=1 %% read data and header information stats_0 = stats.(all_stats) sampling_rate = stats_0.('sampling_rate') delta = stats_0.('delta') starttime = stats_0.('starttime') endtime = stats_0.('endtime') t1 = datetime(starttime,'InputFormat',"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") t2 = datetime(endtime,'InputFormat',"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") datetime_array = t1:seconds(delta):t2 %% Plot waveforms fig = figure('Renderer', 'painters', 'Position',, 'color','w') plot(t1:seconds(delta):t2, data_0, 'k-') title() axis tight print(fig,'-djpeg') data_double = double(data_0) %% Using sym4 = wdenoise(data_double,9,'Wavelet','sym4','DenoisingMethod','BlockJS') close fig2=figure('Renderer', 'painters', 'Position',, 'color','w') plot(data_double,'r') hold on plot(XDEN, 'b') legend('Original Signal','Denoised Signal') axis tight hold off axis tight print(fig2,'-djpeg') snrsym = -20*log10(norm(abs(data_double-XDEN))/norm(data_double)) %% Using db1 = wdenoise(data_double,9,'Wavelet','db1','DenoisingMethod','BlockJS') close fig3=figure('Renderer', 'painters', 'Position',, 'color','w') plot(data_double,'r') hold on plot(XDEN_db1, 'b') legend('Original Signal','Denoised Signal') axis tight hold off axis tight print(fig3,'-djpeg') snrdb1 = -20*log10(norm(abs(data_double-XDEN_db1))/norm(data_double)) end end Wavelet denoising the noisy synthetic data I also highpass filtered the signal to obtain the high-frequency part of the time series. This saves the mseed data into the script directory as well the plot of the “stream”. #Wavelet denoise downloadI will download the waveforms for the arbitrarily selected event " Mww 6.5 Nevada" located at (38.1689°N, 117.8497° W). #Wavelet denoise how toFor details on how to download waveforms using Obspy, see my previous post. I will use the Obspy module to download the data from IRIS. #Wavelet denoise seriesIn this case, I will download the seismic time series recording a major earthquake. Theoretically, we can shrink those coefficients or simply remove them. In general, the coefficients that are smaller in value are considered noise. When we take the wavelet transform of a time series, it concentrates the signal features in a few large-magnitude wavelet coefficients. I have covered the basics of multi-resolution analysis using wavelets in the previous post. We can take advantage of that and preserve important signals, and removing nonuniform noise. It localizes features in the signal to a different scale. Wavelets look at the signals in the multi-resolution window. Here, the wavelet-based approach might have some advantages. However, when the data has high-frequency features such as spikes in a signal or edges in an image, the lowpass filter smooths these out. Also, in Fourier-based denoising, we apply a lowpass filter to remove the noise. Most of our real-world measurements are not stationary. Still, the biggest downside of this approach is that the signal needs to be stationary. Fourier Transform is often used in denoising the signals. Wavelets analysis can be thought of as a general form of Fourier Analysis.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |