This should work for you

sage: import numpy
sage: a=numpy.loadtxt('my_file.txt')
sage: x_vals=a[:,1]
sage: y_vals=a[:,2]

note that now x_vals and y_vals are numpy arrays. At this point you
have a few ways of
of doing the ftt

Option 1
sage: from numpy import fft
sage: fft.fft(x_xvals)
sage: fft.fft(y_vals)

Option 2
If you prefer sage vectors do it this way

sage: import numpy
sage: a=numpy.loadtxt('my_file.txt')
sage: x_vals=vector(RDF,a[:,1])
sage: y_vals=vector(RDF,a[:,2])
sage: x_vals.fft()
sage: y_vals.fft()


If you are familiar with matlab, you should look at numpy and scipy
(import numpy, import scipy). And you might find this helpful
http://www.scipy.org/NumPy_for_Matlab_Users

On Apr 10, 9:25 am, Nicoo <[EMAIL PROTECTED]> wrote:
> simple txt file with columns
> first column is the time, second the X velocity value, third the Y
> velocity value
> and I want to fft each components of velocity to get the frequency of
> oscillations.
> (sry for my bad english)
>
> On 10 avr, 18:16, "William Stein" <[EMAIL PROTECTED]> wrote:
>
> > On Thu, Apr 10, 2008 at 9:15 AM, Nicoo <[EMAIL PROTECTED]> wrote:
>
> > >  thx, I will try the fft() method, other question, how can I load my
> > >  datas in a vector ?
>
> > What format are your datas in?
>
> >  -- William
>
> > >  On 10 avr, 17:40, "William Stein" <[EMAIL PROTECTED]> wrote:
>
> > > > On Thu, Apr 10, 2008 at 8:26 AM, Nicoo <[EMAIL PROTECTED]> wrote:
> > >  > >  Hello there,
> > >  > >  -I used matlab to fft some datas, I have .m file from matlab, is it
> > >  > >  possible to load it in sagemath and use it ?
>
> > >  > No, the Sage programming language is Python, which is as
> > >  > different from Matlab's language as Mathematica is different
> > >  > than Matlab.
>
> > >  > Sage does have fft functionality itself though:
>
> > >  > sage: v = vector(RDF, 10000, range(10000))
> > >  > sage: time w = v.fft()
> > >  > CPU time: 0.00 s,  Wall time: 0.00 s
>
> > >  > It's also possible to use the Sage interfaces to Matlab/Octave...
>
> > >  >  -- William
>
> > --
> > William Stein
> > Associate Professor of Mathematics
> > University of Washingtonhttp://wstein.org
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to