1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| function []=RickerWavelet() clear; clc;
[wavelet_zero1,timez1] = Ricker_zero(20,0.002,100,3); [wavelet_zero2,timez2] = Ricker_zero(10,0.002,100,3); [wavelet_zero3,timez3] = Ricker_zero(20,0.002,100,5);
[wavelet_min1,timem1] = Ricker_minimum(20,0.002,100,3); [wavelet_min2,timem2] = Ricker_minimum(10,0.002,100,3); [wavelet_min3,timem3] = Ricker_minimum(20,0.002,100,5); figure(1)
subplot(1,2,1) plot(timez1,wavelet_zero1,'b',timez2,wavelet_zero2,'r-','linewidth',2); set(gca,'XLim',[0 0.15],'YLim',[-1.0 1.0],'FontSize',13) legend('主频20Hz,子波宽度r=3','主频10Hz,子波宽度r=3'),title('Ricker Wavelet(zero-phase)'),xlabel('Time(s)'),ylabel('Amplitude')
subplot(1,2,2) plot(timem1,wavelet_min1,'b',timem2,wavelet_min2,'r-','linewidth',2); set(gca,'XLim',[0 0.15],'YLim',[-1.0 1.0],'FontSize',13) set(gcf,'unit','normalized','position',[0.2,0.2,0.7,0.5]); legend('主频20Hz,子波宽度r=3','主频10Hz,子波宽度r=3'),title('Ricker Wavelet(minimum-phase)'),xlabel('Time(s)'),ylabel('Amplitude') hold on
figure(2)
subplot(1,2,1) plot(timez1,wavelet_zero1,'b',timez3,wavelet_zero3,'r-','linewidth',2); set(gca,'XLim',[0 0.15],'YLim',[-1.0 1.0],'FontSize',13) legend('主频20Hz,子波宽度r=3','主频20Hz,子波宽度r=5'),title('Ricker Wavelet(zero-phase)'),xlabel('Time(s)'),ylabel('Amplitude')
subplot(1,2,2) plot(timem1,wavelet_min1,'b',timem3,wavelet_min3,'r-','linewidth',2); set(gca,'XLim',[0 0.15],'YLim',[-1.0 1.0],'FontSize',13) set(gcf,'unit','normalized','position',[0.2,0.2,0.7,0.5]); legend('主频20Hz,子波宽度r=3','主频20Hz,子波宽度r=5'),title('Ricker Wavelet(minimum-phase)'),xlabel('Time(s)'),ylabel('Amplitude')
function [wavelet_zero,time]=Ricker_zero(freqs,dt,nt,r)
tmin=0; tmax=dt*nt; time=tmin:dt:tmax; wavelet_zero=exp(-(2*pi*freqs/r)^2*time.^2).*cos(2*pi*freqs.*time); end
function [wavelet_min,time]=Ricker_minimum(freqs,dt,nt,r)
tmin=0; tmax=dt*nt; time=tmin:dt:tmax; wavelet_min=exp(-(2*pi*freqs/r)^2*time.^2).*sin(2*pi*freqs.*time); end
end
|