1.代码
clear clc %haar小波 haar=@(x) 1.*(x>=0&x<=1/2)-1.*(x>1/2&x<=1)+0.*(x>1&x<0); x=-2:0.01:10; y1=haar(x); figure(1) subplot(2,1,1) plot(x,y1); title('基本小波函数Haar') subplot(2,1,2) y2=1/sqrt(3).*haar((x-2)/3); plot(x,y2); title('小波基') %morlet小波 lb=-4; ub=4; n=1000; [psi,xval]=morlet(lb,ub,n); figure(2) plot(xval,psi) title('基本小波函数Morlet') %Mexican Hat(墨西哥草帽)小波 lb=-5; ub=5; N=1000; [psi,xval]=mexihat(lb,ub,N); figure(3) plot(xval,psi) title('基本小波函数Mexican Hat')
2.运行结果