1、调和分析:(tmd_toolbox中)
function [hc,amp,fi,hhat,con]=har(time,h,nc);
% INPUTS: time(n) (days) in Matlab 'datenum' format;
% h(n - tidal time series measured at time;
% nc - number of constituents (if not specified, nc=8);
%
% nc=1->con=['m2 '];
% nc=2->con=['m2 ';'k1 '];
% nc=3->con=['m2 ';'k1 ';'o1 ';]
% nc=4->con=['m2 ';'s2 ';'k1 ';'o1 ';]
% nc=5->con=['m2 ';'s2 ';'k1 ';'o1 ';'p1 '];
% nc=6->con=['m2 ';'s2 ';'n2 ';'k1 ';'o1 ';'p1 '];
% nc=8->con=['m2 ';'s2 ';'n2 ';'k2 '; ...
% 'k1 ';'o1 ';'p1 ';'q1 '];
%
% OUTPUTS: hc - harmonic constant vector (complex);
% amp - amplitude vector;
% fi - phase, degrees;
% hhat - time series reconstructed using HC.m;
% con - constituent IDs (ncx4 character string).
%
% USAGE: [hc,amp,fi,hhat,con]=har(time,h,nc);
%
% Written by Lana Erofeeva (COAS, Oregon State University);
%
% Modified 18-March-2005 by Laurie Padman (ESR), to change time input to
% Matlab 'datenum' time for consistency with other TMD package routines.
%=========================================================================
2、哈希表
有两个关键技术:(1)构建哈希函数;(2)处理冲突;
哈希函数:建立key与位置之间的函数关系,常用方法有取余数、截短求和、取某位数字等,关键是减少冲突;
处理冲突的方法主要有:(1)加某一常数;(2)将冲突的数据存到一个表中,进行二次查询;(3)建立溢出区等;