嵩山少林寺武僧团培训基地七年级英语寒假作业答案大全-
编辑: admin 2017-20-02
-
4
Function wavelet(s,wname,n,options);
Begin
{
功能:
一维序列小波消噪。
参数:
s:一维序列
wname:小波函数名
现有小波函数名(小波函数的选取依靠经验)
Daubechies:
'db1' , 'db2', ... ,'db45' 'db1' 就是haar 小波函数
Coiflets :
'coif1', ... , 'coif5'
Symlets :
'sym2' , ... , 'sym8'
Biorthogonal:
'bior1.1', 'bior1.3' , 'bior1.5'
'bior2.2', 'bior2.4' , 'bior2.6', 'bior2.8'
'bior3.1', 'bior3.3' , 'bior3.5', 'bior3.7'
'bior3.9', 'bior4.4' , 'bior5.5', 'bior6.8'.
Reverse Biorthogonal:
'rbio1.1', 'rbio1.3' , 'rbio1.5'
'rbio2.2', 'rbio2.4' , 'rbio2.6', 'rbio2.8'
'rbio3.1', 'rbio3.3' , 'rbio3.5', 'rbio3.7'
'rbio3.9', 'rbio4.4' , 'rbio5.5', 'rbio6.8'.
n :分解层数
options : 选项
选择字段说明
array('brief':1, // 默认为1 采用简单剔除高频谐波 达到消噪的目的
// 如果为 0 采用估计序列噪音标准差剔除噪音,
'sigma':0, // 为0 默认采用 序列的高阶谐波估计标准差;也可自己输入值
'which':1, // 以 某一层谐波作为噪音估计的数据,默认第一层
'alpha':2, // 阈值惩罚系数,默认为2
"thr":0, // 阈值大小,默认0 采用谐波估计,也可以直接给出
'sorh':'s', // 阈值方式设置,'s' 软阈值,'h'硬阈值 默认为's'
);
返回结果:
一维数字数组,消噪后的序列。
范例:
s := array(2484.82690429688,2479.05493164063,2482.34301757813,2437.794921875,
2447.7548828125,2512.962890625,2443.05688476563,2433.15893554688,
2393.18310546875,2415.05395507813,2392.06201171875,2365.34301757813,
2359.21997070313,2344.787109375,2348.51611328125,2420.00,2438.7900390625,
2431.375,2440.40209960938,2383.48510742188,2377.51196289063,2331.36596679688,
2317.27490234375,2370.3330078125,2409.67211914063,2427.47998046875,
2435.61401367188,2473.40991210938,2468.25,2470.01904296875,2504.10791015625,
2508.09008789063,2528.2939453125,2509.79907226563,2503.8359375,2524.9189453125,
2479.53588867188,2481.083984375,2528.71411132813,2529.76098632813,2466.958984375,
2463.0458984375,2416.56201171875,2415.1298828125,2412.625,2395.06494140625,
2397.55395507813,2380.22412109375,2383.03393554688,2412.39306640625,
2333.4140625,2386.86010742188,2360.6640625,2333.22900390625,2325.90502929688,
2332.72998046875,2329.82006835938,2315.27001953125,2291.544921875,2248.59008789063,
2228.52490234375,2180.89501953125,2224.84008789063,2218.23510742188,2215.92993164063,
2191.14794921875,2186.29711914063,2204.78393554688,2190.11010742188,2166.205078125,
2170.01293945313,2173.56103515625,2199.4169921875,2169.38989257813,2148.45190429688,
2163.39501953125,2225.88989257813,2285.74389648438,2276.0458984375,2275.01000976563,
2244.580078125,2206.19311523438,2298.3759765625,2266.38403320313,2296.07495117188,
2319.11791992188,2285.0380859375,2292.61010742188,2268.080078125,2312.55590820313,
2330.40502929688,2331.13598632813,2291.90209960938,2347.53002929688,2349.58911132813,
2351.98095703125,2351.85498046875,2344.77099609375,2366.70190429688,2356.86010742188,
2357.18090820313,2363.59692382813,2381.42993164063,2403.5869140625,2409.55395507813,
2439.6279296875,2447.05688476563,2451.85693359375,2428.48706054688,2426.11499023438,
2460.69311523438);
n := 2;
options := array('brief':1,'sigma':0,'which':1,'alpha':2,"thr":0,'sorh':'s');
return wavelet(s,wname,n,options) ;
天软数学组
20120627
}
if not ifarray(options) then options := array();
defaut := wavedefaut() union options;
cout := 4;
cl:=wavedec(s,n,wname); //小波分解
if defaut['brief']=1 then
ret :=wrcoef('a',cl[0],cl[1],wname,n);
else
begin
//***************小波消噪*************************************************
k := defaut['which']; //标准差估计选项 ,k 为 1 到 n的整数 默认为1;
if defaut['sigma']=0 then sigma := wnoisest(cl[0],cl[1],k);
else //通过小波第k层细节系数(谐波)估计 ,噪音标准差
sigma := defaut['segma'];
if defaut['alpha']=0 then alpha :=2; // alpha 惩罚因子 大于1 的数 一般为默认2;
else alpha := defaut['alpha'];
if defaut['thr']=0 then
thr := wbmpen(cl[0],cl[1],sigma,alpha); //噪音信号全局阈值
else thr := defaut['thr'];
sorh := defaut['sorh'];
ret:=wdencmp('gbl',cl[0],cl[1],wname,n,thr,sorh)[0]; //采用软阈值和近似信号进行消噪;
end //第一个参数为'gbl'为扩展接口备用,可以随意输入
return ret;
end;
function wavedefaut();
begin
return array('brief':1,'sigma':0,'which':1,'alpha':2,
"thr":0,'sorh':'s'
);
end