
[Sponsors] 
December 10, 2002, 04:39 
pseudospectral methods in matlab

#1 
Guest
Posts: n/a

does anybody have experience in pseudospectral methods in matlab? help me thanks


December 11, 2002, 17:03 
Re: pseudospectral methods in matlab

#2 
Guest
Posts: n/a

I have some experience in pseudospectral methods, but not in matlab...
does this helps? Cheers,Patrick 

December 11, 2002, 18:39 
Re: pseudospectral methods in matlab

#3 
Guest
Posts: n/a

I have experience both in F90 and MATLAB. Email me for help.  Sujit


December 12, 2002, 03:48 
Re: pseudospectral methods in matlab

#4 
Guest
Posts: n/a

The problem is I computed fft and ifft using the matlab inbuilt functions. When I am doing the differentiation of the function and inverse transforming it. I get real and imaginary values. But my input is only real I am wondering how can real input fater diff.. and doing ifft will give imaginary values. please help..


December 12, 2002, 06:27 
Re: pseudospectral methods in matlab

#5 
Guest
Posts: n/a

I suggest you post this question to the comp.softsys.matlab newsgroup. There's loads of DSP gurus on there who'll help for free.


December 12, 2002, 12:49 
Re: pseudospectral methods in matlab

#6 
Guest
Posts: n/a

Its easy:
MATLAB does a Forward FFT by the typical real to complex algorithm. Similarly you can do ndimensional complex to complex forward transforms using fft(). To do an inverse transform, use ifft(). ifft() can do a complex to complex and complex to real inverse transform. If the data on inverting is purely real, the MATLAB algorithm may return small imaginary parts which can be zeroed out. If you want me to go into details about how modes are stored, let me know. Sujit 

December 12, 2002, 14:31 
Re: pseudospectral methods in matlab

#7 
Guest
Posts: n/a

Hi,
You got some answers concerning matlab, concerning Fourier pseudospectral methods: Use FFT where there is a place for the real and complex part of the vector. Put the function in the real part and put 0 (zero) in the complex one. Do your FFT forward and then multiply the results by ij, where i=sqrt(1) and j is the discrete index number. This means that the complex value (obtained from the FFT) will now be real and that the real value (obtained from the FFT) will now be complex. Then put these back in you vector, taking care of putting the new complex and the new real in their appropriate place in the input vector. Then carried out an inverse FFT of that input vector and consider only the real part of it as your Fourier derivative. It is very important to take care of identifying correctly what is j in your program (subroutine) since you have to multiply by j between the two FFT, and will you have also to divide by N (the number of points; k=0,1,..N/2) to normalize properly. This is if you work on a [0:2pi] segments. I am copying here below a FORTRAN subroutine for what I just wrote for Fourier pseudospectral solver, using the Fortran FFT I hope this helps, Patrick subroutine pdfrnt2(f,df,if) integer i,n,if,j,it,nt,ir,nr include 'input.par' parameter (n=nt,nr=2**ir) real*8 f(n),df(n),c2(2,n),c1(2,n) real*8 fil(0:n/2),cut(0:nr),dn common /filter/cut,fil dn=dfloat(n) do i=1,n c1(1,i)=f(i)/dn > real value divided by N c1(2,i)=0.d0 > imaginary part end do call DFOURT(c1,n,1,1,0,0.d0) > FFT is return in c1 do i=1,n/2+1 j=i1 c2(1,i)=dfloat(j)*c1(2,i) > multiply by ij c2(2,i)=dfloat(j)*c1(1,i)> multiply by ij end do do i=n/2+2,n j=in1 c2(1,i)=dfloat(j)*c1(2,i)> multiply by ij c2(2,i)=dfloat(j)*c1(1,i)> multiply by ij end do call dfourt(c2,n,1,1,1,0.d0)> back FFT into c1 do i=1,n df(i)=c2(1,i)> here is the Fourier derivative end do return END 

December 13, 2002, 08:19 
Re: pseudospectral methods in matlab

#8 
Guest
Posts: n/a

How to do differentiation is there any command in matlab. I am getting the complex values of this diffrentiation(of real values) it is not possible. I don not know where is the error. Do you have literature pf pseudospectral methods in matlab. I want to disscuss this issue in deep. thanks prasat


December 13, 2002, 15:18 
Re: pseudospectral methods in matlab

#9 
Guest
Posts: n/a

Although I don't understand what your question is, this is what I think you should be doing.
=>Take a discrete real function (1D, 2D, 3D, etc) =>Take it into Fourier Space by MATLAB function fftn() =>To differentiate a function in Fourier Space simply multiply each coefficient by  i * (wavenumber in the direction of the derivative) =>To get back the differentiated function on Physical space use MATLAB function ifftn() and neglect any imaginary part returned. Hope this helps. 

December 16, 2002, 05:02 
Re: pseudospectral methods in matlab

#10 
Guest
Posts: n/a


December 16, 2002, 05:08 
Re: pseudospectral methods in matlab

#11 
Guest
Posts: n/a


December 16, 2002, 07:30 
Re: pseudospectral methods in matlab

#12 
Guest
Posts: n/a

Hai sujit, Whya should I neglect the complex part after getting the diff in physical space. Lets suppose that I have neglected it but then How will I confirm that my diffentiation is correct. That is my basic questions Prasat


December 16, 2002, 11:44 
Re: pseudospectral methods in matlab

#13 
Guest
Posts: n/a

MATLAB's documentation (type : help ifftn) says that the FFT works such that the same function ifftn does both the inverse complextocomplex and complextorealsymmetric transforms.
In case of the latter, you get back complex vectors (matrices) with very small imaginary parts, which you can throw away. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to start Fluent with Matlab??  Jay Hu  FLUENT  5  October 9, 2013 14:20 
comments on FDM, FEM, FVM, SM, SEM, DSEM, BEM  kenn  Main CFD Forum  2  July 18, 2004 18:28 
pseudospectral help?  jack  Main CFD Forum  1  January 20, 2004 20:34 
PseudoSpectral Methods  M. Abedi  Main CFD Forum  2  July 15, 2001 17:46 
CFD  Trends and Perspectives  Jonas Larsson  Main CFD Forum  16  August 7, 1998 16:27 