matlab小波变换

来源:百度知道 编辑:UC知道 时间:2024/05/28 13:08:00
p=[1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996];

t=[0.1342 0.5631 6.945 24.5891 4.8803 146.5025 190.8005 251.2409 17.4564 48.709 0.1877 0.1218 1.4078 4.2233 6.0065 56.5926 74.8936 34.3497 169.7777 219.3314 22.806 20.3658 9.479 0.3825];
figure,plot(p,t);title('原始曲线');
[C,L]=wavedec(k,3,'db3');
cA3=appcoef(C,L,'db3',3);
[cD1,cD2,cD3]=detcoef(C,L,[1,2,3]);
A3=wrcoef('a',C,L,'db3',3);
D1=wrcoef('d',C,L,'db3',1);
D2=wrcoef('d',C,L,'db3',2);
D3=wrcoef('d',C,L,'db3',3);
figure,plot(A3);title('Aprroximation A3');
figure,plot(D1);title('Detail D1');
figure,plot(D2);title('Detail D2');
figure,plot(D3);title('Detail D3');
A0=waverec(C,L,'db3');
figure,plot(A0);title('重构曲线');

其中,[C,L]=wavedec(k,3,&#

k=load('1.txt')

1.txt文件中应当就是数据,最好是矩阵形式的数据。

0.1432 1973
0.5631 1974
.........

把数据写入1.txt中在matlab中
保存成.mat就可以了

在这句[C,L]=wavedec(k,3,'db3');前加上k=t;不过绘出的图的横坐标就变了。