Matlab provides a function to generate wavelet function values and wavelet scaling values via build-in function called *wavefun*. (type *help wavefun* at Matlab command windows for information regarding wavefun function).

However, apart from Matlab build-in function,I’ve found out another way to produce psi and phi function during investigation of Wavelet application to mechanical vibration signal. The script invented make use of a function called *daub.m* which is taken from Uvi Wave v3 (a free wavelet toolbox for Matlab). Uvi Wave v3 can be downloaded from http://cas.ensmp.fr/~chaplais/UviWave/Uvi_Wave_300.zip, or only the file daub.m can be downloaded from here. After extracting the zip file, *daub.m* can be copied from Uvi_Wave_300 folder at /Uvi_Wave_300/wfilter/. Copy the *daub.m* to a folder which has been included in Matlab search path, or include the entire Uvi_wave_300 folder in Matlab search path.

Here are the codes for producing db(x) wavelet function (psi).

`clc; clear all; close all;`

%

db_type = 4; % db(x), x = 2,4,6,8, ...

[hh,gg,rh,rg] = daub(db_type); % from Uvi Wave 300

h = rh .* 1.414;

g = rg .* 1.414;

%

psi=1;

psi=conv(psi,g);

n=10; %number of iteration

psi=upsample(psi,2);

%

for i=1:n

psi=conv(psi,h);

if i<n

psi=upsample(psi,2);

end

end

%

x=linspace (0,3,length(psi));

%

plot(x,psi)

judul= ['db',num2str(db_type),' psi (wavelet) function'];

title(judul);

And here are the codes for calculating db(x) scaling function (phi),

`clc; clear all; close all;`

%

db_type = 4; % db(x), x = 2,4,6,8, ...

[h,g,rh,rg] = daub(db_type); % from Uvi Wave 300

h = rh .* 1.414;

%

phi=1; %initial pulse]
phi=conv(phi,h);

n=10; %number of iteration

phi=upsample(phi,2);

%

for i = 1:n

phi = conv(h,phi) ;

if i<n % last convolved need not go for upsampling

phi = upsample(phi,2);

end

end

%

x = linspace(0,3,length(phi));

%

plot(x,phi,'r-')

judul = ['db',num2str(db_type),' phi (scaling) function'];

title(judul);

Below are the plots produced using wavelet psi and phi scripts presented above.

*Soman, K.P. & Ramachandran, K.I., (2004), Insights into Wavelets: From Theory to Practice, p.123, Prentice-Hall India Pvt Ltd.**http://webdev.apl.jhu.edu/~beser/525759/uvi_wave-3.0.doc.pdf*