xmichelle

57 Reputation

2 Badges

16 years, 56 days

MaplePrimes Activity


These are answers submitted by xmichelle

the problem has been sorted now! there was a normalization factor in the wavelet (g) that didnt need to be there. Thankyou for your help

restart:
#f:=readdata("test.txt"):
with(linalg):
total:=95:
deltat:=0.0025:
sampling:=1:
jend:=20:
tend:=deltat*nn:
f:=seq(evalf(cos(0.2*t)),t=0..total-1):
A:= Array(1..jend, 1 .. total, 1..3, datatype=float[8]);
   for i from 1 to total do
   tau:= (i-1)*deltat/sampling;  
      for j from 1 to jend do
      s:= (j-0.9)*deltat/sampling;
g := proc (t) options operator, arrow; (1-(t-tau)^2/s^2)*exp(-(1/2)*(t-tau)^2/s^2)/(sqrt(2*Pi)*s^2) end proc;
         A[j,i,1]:= s;
         A[j,i,2]:= tau;
         A[j,i,3]:= evalf(sum(evalf(deltat*f[m+1]*g(deltat*m)), m = 0 .. total-1)/sqrt(s));
    end do: end do:
    with(plots):
    surfdata(A, style=patchnogrid, axes=box);
 

I seems that no matter what frequency cosine has, the value of s is always the same

Thankyou for you help, I have had to rewrite it slightly and have the following,


restart:
#f:=readdata("test.txt"):
with(linalg):
nn:=95:
jend:=20:
deltat:=0.0025:
sampling:=10:
tend:=deltat*nn:
f:=seq(evalf(cos(2.0*Pi/(tend/5) * t/(nn-1))),t=0..nn-1):
f[1];f[nn];
A:= Array(1..jend, 1 .. nn, 1..3, datatype=float[8]);
   for i from 1 to nn do
   tau:= (i-1)*deltat;  
      for j from 1 to jend do
s:= (j-1)*deltat*2.0;
g := proc (t) options operator, arrow; (1-(t-tau)^2/s^2)*exp(-(1/2)*(t-tau)^2/s^2)/(sqrt(2*Pi)*s^2) end proc;
         A[j,i,1]:= s;
         A[j,i,2]:= tau;
         A[j,i,3]:= evalf(sum(evalf(deltat*f[m+1]*g(deltat*m)), m = 0 .. nn-1)/sqrt(s));
#A[s,i,3]:= evalhf(add(0.25e-2*f[m+1]*(1-(0.25e-2*m-tau)^2/s^2)*exp(-(1/2)*(0.25e-2*m-tau)^2/s^2)/(sqrt(2*Pi)*s^2), m = 0 .. nn-1));
    end do: end do:
    with(plots):
    surfdata(A, style=patchnogrid, axes=box);
 

 

However, the value of s on the graph always seems to be very close to 0? can you solve this problem?

 

oh i have to swap t and f round i think

thankyou for your help!

ive been trying to replicate this type of graph

 

http://users.rowan.edu/~polikar/WAVELETS/figure1_123.gif

 

so i changed the axis to go up to 1000, but it means i have to used frequencies 1/100 and 1/333 to match the number of periods sine has but then thats not 3hx and 10hz

f1,f2 := 1/100, 1/333: # frequencies, as cycles/second

plot([sin(f1*t*2*Pi),sin(f2*t*2*Pi)],t=0..1000,
     labels=[typeset(Unit(s)),cycle],
     legend=[typeset(f1*Unit(Hz)),typeset(f2*Unit(Hz))]);

im confused!

Page 1 of 1