如下,根据小波局部模极大值求解李氏指数,程序如下,有错,大侠帮忙啊(照着论文中的做的,原信号编程有点差异,附件将论文传上了)
clc
T=0:0.001:3;
A=(1-(abs(0.16-T).^0.6)).*(T<=0.16&T>0)+(1-(abs(0.16-T).^0.2)).*(T<=0.32&T>0.16)+(1-(abs(0.56-T).^0.8)).*...
(T<=0.56&T>0.32)+(1-(abs(0.56-T).^0.4)).*(T<=0.72&T>0.56)+(1.8-(abs(0.72-T).^0)).*(T<=2&T>0.72)+((-0.8+(abs(0.72-T).^0)).*(T<=3&T>1));
plot(T,A)
% 参数设置, 把信号signal 进行连续小波变换、取绝对值。
startscale = 1; endscale = 20; cwtfunction = 'gaus1';
w = cwt( A, startscale:endscale, cwtfunction) ; f = abs (w ) ;
% 步骤1: 获取f 矩阵的局部模极大值暂存wtfm 矩阵。
% 步骤2: 归类极大值线。
tranm = wtfm'; [post, scat] = find ( tranm~= 1); % 利用FIND 命令, 搜索极大值点。
pos = post'; sca = scat'; index = 1; lsca = length (sca);
for scale = 1:lsca
[r,c] = find ( sca = = scale); linenumber = length (c);
for i = 1: linenumber
linesca ( i, index) = sca(c(i)) ; linepos(i,index) = pos (c(i)) ; %每行表示同一极大值线的尺度与位置。
end
index=index + 1;
end
[lineN ,n] = size(linepos);
for lineindex = 1: lineN
[ r, c ] = find ( linepos( lineindex,: )~= 0); [ l,mm ] = size (c) ;
for scale = (c(1) + 1):(mm + c (1) - 1)
temp = linepos (lineindex, scale-1) - linepos(lineindex:lineN , scale);
[valuemin, distancemin ] = min(abs(temp) );
if valuemin < = deltas % 排序位置、排序尺度。
tempwappos = linepos(lineindex, scale); tempwapsca =linesca ( lineindex, scale) ;
linepos(lineindex, scale) = linepos(distancem in + lineindex- 1, scale);
linesca ( lineindex, scale) = linesca (distancem in + lineindex-1, scale);
linepos (distancem in + lineindex - 1, scale) = tempwappos;
linesca(distancemin + lineindex - 1, scale) = tempwapsca;
else
linepos ( lineindex, scale) = 0; linesca ( lineindex, scale) = 0;
end
end
end
% 步骤3: 用函数glmfit 作线性拟合。
for num = 1: linetotalnumber
b = glmfit(logs( infacindex) , logwtfm( infacindex) , 'normal');
alp = b (2, 1); lipschitzexp(num) = alp - 0. 5; % 计算李氏指数。
end
希望帮忙看下,在线等
2011-4-11 16:06 上传
点击文件名下载附件
318.72 KB, 下载次数: 36956