<div dir="ltr"><div><div><div>Hi Antoine,<br><br></div>The prn files are just plain text files, no idea why they were given prn as an extension, that's how they came with the Mathcad code. They can be loaded into Notepad with no problem)<br>
<br></div>The complex issue is coming from the forward and inverse fft as you say. I am kind of suspicious if it is actually loading the data files properly?<br></div><div><br><pre style="font-family:Monospaced;font-style:normal">
<span style="color:rgb(0,0,0)">c</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">fft</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">obs_topo1</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span> =  COMPLEX

<span style="color:rgb(0,0,0)">k</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">0</span><span style="color:rgb(255,170,0)">:</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(255,170,0)">:</span><span style="color:rgb(0,0,0)">npts</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(0,0,0)">;</span>

<span style="color:rgb(0,0,0)">phik</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">D</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">k</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(0,0,0)">XKint</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(92,92,92)">^</span><span style="color:rgb(188,143,143)">4</span><span style="color:rgb(92,92,92)">/</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">g</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">rho_m</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(0,0,0)">rho_c</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(92,92,92)">+</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(92,92,92)">^</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(0,0,0)">Zflexure</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">2</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(218,112,214)">%pi</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(0,0,0)">G</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(188,143,143)">1e5</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">rho_c</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(0,0,0)">rho_w</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(92,92,92)">.*</span><span style="color:rgb(50,185,185)">exp</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(0,0,0)">k</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(0,0,0)">XKint</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(0,0,0)">mean_depth</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(92,92,92)">.*</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(0,0,0)">phik</span><span style="color:rgb(92,92,92)">.*</span><span style="color:rgb(50,185,185)">exp</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(0,0,0)">XKint</span><span style="color:rgb(92,92,92)">*</span><span style="color:rgb(0,0,0)">ocean_thick</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>

<span style="color:rgb(0,0,0)">factork</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(0,0,0)">Zflexure</span> <span style="color:rgb(92,92,92)">*</span> <span style="color:rgb(0,0,0)">c</span><span style="color:rgb(0,0,0)">;</span> = COMPLEX (single value eg -4.490857598202565E-10-8.427771813321494E-11*%i)<br>

<span style="color:rgb(0,0,0)">calc_grv</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(174,92,176);text-decoration:underline">ifft</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">factork</span><span style="color:rgb(74,85,219)">) = COMPLEX - this should be a real set of values.<br>
</span><br><br></pre><div>Cheers<br></div>Lester<pre style="font-family:Monospaced;font-style:normal"><br></pre></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 26 August 2013 09:24, Antoine Monmayrant <span dir="ltr"><<a href="mailto:antoine.monmayrant@laas.fr" target="_blank">antoine.monmayrant@laas.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    <div>On 25/08/2013 12:45, Lester Anderson
      wrote:<br>
    </div>
    <blockquote type="cite">
      <pre>Hi all,

I am attempting to code up a Mathcad file into Scilab and it should be
straightforward, but for some reason it is not working as it should. And
checking the variable values, some are still complex as output from the
fft/ifft runs - the inputs look right as far as I can see.</pre>
    </blockquote></div>
    I cannot open the prn files and it's thus difficult for me to check
    your data.<br>
    What do you mean by still complex?<br>
    When you run fft or ifft on a real dataset, the output is complex,
    that's to be expected.<br>
    Maybe (it's just a wild guess) you ended up with complex values that
    have an imaginary part that is zero.<br>
    Scilab still consider these values to be complex.<br>
    <br>
    Antoine<br>
    <blockquote type="cite"><div class="im">
      <pre>
If someone can see what the issue is and a solution, that would be great.

Attached my quick attempt at converting the Mathcad code (see PDF) and the
input profile data (*.prn files)

Cheers

Lester
</pre>
      <br>
      <fieldset></fieldset>
      <br>
      </div><pre>_______________________________________________
users mailing list
<a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a>
<a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a></pre>
    </blockquote>
    <br>
    <br>
    <pre cols="72">
</pre>
  </div>

<br>_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>