主要内容:

  1. 傅里叶矩阵及其MATLAB实现
  2. 小波变换矩阵及其MATLAB实现 

傅里叶矩阵及其MATLAB实现

傅里叶矩阵的定义:(来源: http://mathworld.wolfram.com/FourierMatrix.html

傅里叶矩阵的MATLAB实现:

  dftmtx(N) is the N-by-N complex matrix of values around the unit-circle whose inner product with a column vector of length N yields the discrete Fourier transform of the vector. If X is a column vector of length N, then dftmtx(N)*X yields the same result as FFT(X); however, FFT(X) is more efficient.

  The inverse discrete Fourier transform matrix is CONJ(dftmtx(N))/N.

% clc;clear;
N = ;
X = randn(N,);
dft_result1 = dftmtx(N)*X;
dft_result2 = fft(X);
% isEqual = all(dft_result1 == dft_result2);
err = norm(dft_result1(:)-dft_result2(:));
if err < 0.01
fprintf('dftmtx(N)*X yields the same result as FFT(X)');
else
fprintf('dftmtx(N)*X does not yield the same result as FFT(X)');
end

小波变换矩阵及其MATLAB实现

小波变换矩阵的概念:

参考:http://blog.csdn.net/jbb0523/article/details/42470103

小波变换矩阵的MATLAB实现:

function [ ww ] = dwtmtx( N,wtype,wlev )
%DWTMTX Discrete wavelet transform matrix
% This function generates the transform matrix ww according to input
% parameters N,wtype,wlev .
%Detailed explanation goes here
% N is the dimension of ww
% wtype is the wavelet type
% wlev is the number of decomposition level
%NOTE: The extension mode must be Periodization('per')
[h,g]= wfilters(wtype,'d'); %Decomposition low&high pass filter
L=length(h); %Filter length
h_1 = fliplr(h); %Flip matrix left to right
g_1 = fliplr(g);
loop_max = log2(N);
loop_min = double(int8(log2(L)))+;
if wlev>loop_max-loop_min+
fprintf('\nWaring: wlev is too big\n');
fprintf('The biggest wlev is %d\n',loop_max-loop_min+);
wlev = loop_max-loop_min+;
end
ww=;
for loop = loop_max-wlev+:loop_max
Nii = ^loop;
p1_0 = [h_1 zeros(,Nii-L)];
p2_0 = [g_1 zeros(,Nii-L)];
p1 = zeros(Nii/,Nii);
p2 = zeros(Nii/,Nii);
for ii=:Nii/
p1(ii,:)=circshift(p1_0',2*(ii-1)+1-(L-1)+L/2-1)';
p2(ii,:)=circshift(p2_0',2*(ii-1)+1-(L-1)+L/2-1)';
end
w1=[p1;p2];
mm=^loop_max-length(w1);
w=[w1,zeros(length(w1),mm);zeros(mm,length(w1)),eye(mm,mm)];
ww=ww*w;
clear p1;clear p2;
end %The end!!!
end

验证是否与Matlab自带的函数wavedec所得结果一致:

%验证函数dwtmtx的正确性
clear all;close all;clc;
N = ^;
% 'db1' or 'haar', 'db2', ... ,'db10', ... , 'db45'
% 'coif1', ... , 'coif5'
% 'sym2', ... , 'sym8', ... ,'sym45'
% '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'
% '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'
wtype = 'rbio6.8';
wlev_max = wmaxlev(N,wtype);
if wlev_max ==
fprintf('\nThe parameter N and wtype does not match!\n');
end
dwtmode('per');
for wlev = :wlev_max
ww = dwtmtx(N,wtype,wlev);
x = randn(,N);
y1 = (ww*x')';
[y2,y2l] = wavedec(x,wlev,wtype);
y_err = sum((y1-y2).*(y1-y2));
fprintf('wlev = %d: y_err = %f\n',wlev,y_err);
end

最新文章

  1. python leetcode 1
  2. logo上传
  3. csharp: MongoDB
  4. 超图(hypergraph)
  5. mongodb用户授权
  6. static_cast .xml
  7. Selenium Tutorial (1) - Starting with Selenium WebDriver
  8. 【转】C++对象内存分配问题
  9. java se基础
  10. 10g和11g,优化器对外连接的处理对比
  11. Matlab编程-矩阵函数
  12. 03 - 替换vtkDataObject中的GetProducerPort()方法 VTK 6.0 迁移
  13. mysql数据库学习(二)--表操作
  14. hdu 3709 数字dp(小思)
  15. web CSS的知识- 关于后代选择器,子选择器,兄弟选择器的使用
  16. jpg、jpeg、png...&#160;的区别
  17. docker命令不需要敲sudo的方法
  18. ubuntu16.04之mongodb自动备份
  19. webpack 2 系列
  20. mybatis中useGeneratedKeys和keyProperty的作用

热门文章

  1. gitblit无法安装windows服务或者启动服务失败:Failed creating java
  2. 如何自定义 maven中的archetype
  3. 使用FTP发布和更新Windows Azure网站
  4. Javascript:原型模式类继承
  5. Android 开机画面和wallpaper总结
  6. 通俗易懂地讲解 __block 变量
  7. .NET:枚举的默认值
  8. 查看Linux进程CPU过高具体的线程堆栈(不中断程序)
  9. Storm实时计算系统
  10. linux syslog详解 转