小波差值与构造
源代码在线查看: 小波插值与小波构造(3个程序).txt
软件大小: |
2 K |
上传用户: |
a415834839 |
|
|
关键词: |
|
下载地址: |
免注册下载 普通下载
|
|
小波插值与小波构造(3个程序)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 小波构造 function casade
clear;clc;
t=3;
phi=[0,1,0]; h=wfilters('db7','r');
h=h*sqrt(2); h_e=h(1,[2:2:14]);
h_o=h(1,[1:2:13]); for m=1:15;
stem(phi);
drawnow;
pause(1);
ee=conv(h_e,phi);
oo=conv(h_o,phi);
phi(1,[2:2:2*length(ee)])=ee;
phi(1,[1:2:2*length(oo)-1])=oo;
end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% cubic_average(立方b样条)
% 均值插值 % 初始化
s=[0 0 1 0 0] % 正弦波
% f=50;
% ts=1/200;
% n=0:16;
% s=sin(2*pi*f*n*ts); % 系数
se=[1/8,6/8,1/8];
so=[4/8,4/8] % 循环
for p=1:10;
t=length(s)-1;
o(1:t)=s(1:t)*so(1)+s(2:t+1)*so(2);
e(1)=s(t+1)*se(1)+s(1)*se(2)+s(2)*se(3);
e(2:t)=s(1:t-1)*se(1)+s(2:t)*se(2)+s(3:t+1)*se(3);
e(t+1)=s(t)*se(1)+s(t+1)*se(2)+s(1)*se(3);
s([1:2:2*t+1])=e([1:t+1]);
s([2:2:2*t])=o([1:t]);
plot(s);
drawnow;
end; % 抽取
t=length(s); % 总长度
p=128; % 需要点数 % 间隔
d=(t-1)/p; % 最终尺度函数
r=s(2:d:t-1); % 画图
figure(2);
plot(r);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% cubic_subdivision(立方插值)
% 细分插值 % %% 初始化(尺度函数)
% s=[0,0,1,0,0]; % 正弦函数
n=1:20;
f=50;
ts=1/200;
s=sin(2*pi*f*n*ts); % 指数函数
% n=0:16;
% s=exp(n); % % 系数
a=[-1/16,9/16,9/16,-1/16]; % 循环
for p=1:4;
t=length(s)-1;
o(1)=s(4)*a(1)+s(1)*a(2)+s(2)*a(3)+s(3)*a(4);
o(2:t-1)=s(1:t-2)*a(1)+s(2:t-1)*a(2)+s(3:t)*a(3)+s(4:t+1)*a(4);
o(t)=s(t-2)*a(4)+s(t+1)*a(3)+s(t)*a(2)+s(t-1)*a(1);
s([1:2:2*t+1])=s([1:t+1]);
s([2:2:2*t])=o([1:t]);
plot(s);
drawnow;
end; % % 抽取
% t=length(s); % 总长度
% p=128; % 需要点数
%
% % 间隔
% d=(t-1)/p;
%
% % 最终尺度函数
% r=s(2:d:t-1);
%
% % 画图
% figure(2);
% plot(r);