0
$\begingroup$

The complex Shannon function is defined as:

enter image description here

It seems that Mathematica doesn't support the complex Shannon transform although it supports the real Shannon function. I need the complex Shannon function to run a discrete wavelet transform. Can I define a new wavelet exactly like the equation for complex Shannon?

$\endgroup$
1

1 Answer 1

2
$\begingroup$

$\color{red}{\text{In different definitions,}}$

$\color{red}{\text{there may be horizontal axis scaling, vertical axis scaling, horizontal axis shift.}}$

$\color{red}{\text{but you should make sure the shapes are consistent.}}$

Mathematica

mySincFunction[x_] := If[x == 0, 1, Sin[Pi x]/(Pi x)];
shanwavf[LB_, UB_, N_, FB_, FC_] := 
 Module[{XRange, psi}, XRange = Range[LB, UB, (UB - LB)/(N - 1)];
  psi = Table[(FB^0.5)*(mySincFunction[FB X]*Exp[2 I Pi FC X]), {X, 
     XRange}];
  {psi, XRange}]
{psi, x} = shanwavf[-20, 20, 1000, 1, 1.5];

GraphicsRow[{ListLinePlot[Transpose[{x, Re[psi]}], 
   PlotLabel -> "Complex Shannon Wavelet - Real Part", 
   AxesLabel -> {"X", "Real Part"}, PlotRange -> Full], 
  ListLinePlot[Transpose[{x, Im[psi]}], 
   PlotLabel -> "Complex Shannon Wavelet - Imaginary Part", 
   AxesLabel -> {"X", "Imaginary Part"}, PlotRange -> Full]}]

enter image description here

now DefiningYourOwnWavelet. I'm not sure whether the below code is true.

ComplexShannonWavelet[LB_, UB_, N_, FB_, FC_]["WaveletQ"] := True;
ComplexShannonWavelet[LB_, UB_, N_, FB_, FC_]["OrthogonalQ"] := True
ComplexShannonWavelet[LB_, UB_, N_, FB_, FC_]["PrimalLowpass", 
   prec_ : MachinePrecision] := 
  Module[{psi, X}, {psi, X} = shanwavf[LB, UB, N, FB, FC]; psi];


yourImage = Import["ExampleData/photo.jpg"]
dwd = DiscreteWaveletTransform[yourImage, ComplexShannonWavelet[-20, 20, 100, 1, 1.5], 2]

MATLAB

Why don't you use shanwavf in MATLAB, which seems more practical.

fb = 1;
fc = 1.5;
lb = -20; 
ub = 20; 
n = 1000;
[psi,x] = shanwavf(lb,ub,n,fb,fc);
subplot(2,1,1)
plot(x,real(psi))
title('Complex Shannon Wavelet')
xlabel('Real Part')
grid on
subplot(2,1,2)
plot(x,imag(psi))
xlabel('Imaginary Part')
grid on

enter image description here

$\endgroup$
1
  • $\begingroup$ if i want cwt(Continuous wavelet transform) Instead of dwt i need fourier factor and fourier transform so how can this be defined for Shannon? $\endgroup$ Oct 12, 2023 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.