<div dir="ltr">Thank you, sir. The problem of a and b is solved. Now, I am facing difficulty for making a new array for f and output.<div><br></div><div>do n=0,N-1<br> do k=0,KMAX-1<br> f(k,n) = a(k)*cos(k*n*temp2)+ b(k)*sin(k*n*temp2)<br> end do<br> output(n)=(sum(f(0,n))) ; 0 used for Fourier Decomposition (wave number 1)<br> return([/output/])<br>end do<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 9 Sep 2019 at 23:12, Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>[1] You should put 'print' statements in your code when testing.</div><div><br></div><div>[2] You did not initialize the a(k) and b(k) values for each 'k'</div><div><br></div><div>[3] <br></div><div>f = new((/ k,t /), typeof(in),getVarFillValue(in))</div><div><br></div><div>the 'k' and 't' are index values for the previous do loops. They are not dimension sizes.</div><div><br></div><div>---</div><div>Attached is an old test code that should help you. <br></div><div>It produces results from '<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ezfftf.shtml" target="_blank"><b>ezfftf</b></a>'<br></div><div>You can comment the fortran section.<br></div><div>Please note, it is **your responsibility** to think about what is is being done.</div><div><br></div>Please talk to a local person is knows the Fourier Transform<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 9, 2019 at 4:02 AM Md. Jalal Uddin via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br><div><div>The following Fourier Transformation Function gives me constant 0 value. Is there anyone who can guide me to solve this issue? </div><div><br></div>undef ("fftwavenumber") <br>function fftwavenumber (in[*]:numeric) <br><br>local in,p,a,b,f,output<span class="gmail-m_-410659265313129860gmail-m_-2472097642995770428gmail-im" style="color:rgb(80,0,80)"><br><br>begin<br> N=dimsizes(in)<br><br> if mod(N,2).eq.0 then<br> p=N/2 ; N even<br> else<br> p=(N-1)/2 ; N odd<br> end if<br><br>pi=3.1416<br><br>a = new((/ p /), typeof(in),getVarFillValue(in))<br>b = new((/ p /), typeof(in),getVarFillValue(in))<br><br>do k=0,p-1<br></span> do t=0,N-1<br> a(k) = (2/N)*( in(t)*cos(2*pi*k*t/N) )<br> b(k) = (2/N)*( in(t)*sin(2*pi*k*t/N) )<span class="gmail-m_-410659265313129860gmail-m_-2472097642995770428gmail-im" style="color:rgb(80,0,80)"><br> end do<br>end do<br><br>f = new((/ k,t /), typeof(in),getVarFillValue(in))<br>output = new((/ t /), typeof(in),getVarFillValue(in))<br><br>do t=0,N-1<br> do k=0,p-1<br> f(k,t) = a(k)*cos(2*pi*k*t/N)+ b(k)*sin(2*pi*k*t/N)<br> end do<br></span> output(t)=(sum(f(0,t))) ; 0 used for Fourier Decomposition (wave number 1)<br> return(output)<br>end do<br>end <br></div><div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-410659265313129860gmail-m_-2472097642995770428gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr"><span style="letter-spacing:0.2px">B.Sc. in Disaster Management (Hons.) </span><br></div><div dir="ltr"><span style="letter-spacing:0.2px">Patuakhali Science and Technology University, Bangladesh.</span></div><div dir="ltr">Cell: +8613260859092, <span style="letter-spacing:0.2px">+8801792052662</span></div><div dir="ltr"><font size="2">Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-jalal-uddin-80a026b0</a> </font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#000000" size="2"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr"><span style="letter-spacing:0.2px">B.Sc. in Disaster Management (Hons.) </span><br></div><div dir="ltr"><span style="letter-spacing:0.2px">Patuakhali Science and Technology University, Bangladesh.</span></div><div dir="ltr">Cell: +8613260859092, <span style="letter-spacing:0.2px">+8801792052662</span></div><div dir="ltr"><font size="2">Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-jalal-uddin-80a026b0</a> </font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>