<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>dear all<br><br>I'm novice in Fourier series and other and my question is probably naive (sorry for this) => I'm wondering if scilab can directly calculate the Fourier coefficient a0, a_k and b_k ?<div><br></div><div>I'm currently doing it "by hand" is order to familiarise myself with it (and I'm looking at the same time to documents on  FFT use and rules to refind the 2 natural frequencies of the example here bellow), but it seems I'll need to code the coefficient calculations ... Am I right ?</div><div></div><div><br></div><div>Thanks</div><div><br></div><div>Paul</div><div><br><br>#########################################################################<br><pre style="font-family: Monospaced; font-size: 15px;">mode<span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(74,85,219);">)</span>

<span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(131,67,16);">y</span><span style="color:rgb(92,92,92);">=</span><span style="text-decoration: underline;">f</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);">x</span><span style="color:rgb(74,85,219);">)</span>
    <span style="color:rgb(131,67,16);">y</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">2.</span><span style="color:rgb(92,92,92);">*</span>sin<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(131,67,16);">x</span><span style="color:rgb(74,85,219);">) </span><span style="color:rgb(92,92,92);">- </span><span style="color:rgb(188,143,143);">3.</span><span style="color:rgb(92,92,92);">*</span><span style="color:rgb(50,185,185);">cos</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(218,112,214);">%pi</span> <span style="color:rgb(92,92,92);">*</span> <span style="color:rgb(131,67,16);">x</span><span style="color:rgb(74,85,219);">)</span>;
<span style="color:rgb(176,24,19);">endfunction</span>

periode <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">2</span>;
number_of_periodes <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">1</span>;
n <span style="color:rgb(92,92,92);">=</span> periode <span style="color:rgb(92,92,92);">*</span> number_of_periodes;

x <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(188,143,143);">0</span> <span style="color:rgb(255,170,0);">:</span> <span style="color:rgb(218,112,214);">%pi</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(188,143,143);">100</span> <span style="color:rgb(255,170,0);">:</span> n<span style="color:rgb(74,85,219);">]</span><span style="color:rgb(92,92,92);">'</span>;
y <span style="color:rgb(92,92,92);">=</span> <span style="text-decoration: underline;">f</span><span style="color:rgb(74,85,219);">(</span>x<span style="color:rgb(74,85,219);">)</span>;
<pre style="font-family: Monospaced;">N <span style="color:rgb(92,92,92);">=</span> size<span style="color:rgb(74,85,219);">(</span>x,<span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">*</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span>;</pre>
scf<span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span>
plot2d<span style="color:rgb(74,85,219);">(</span>x,y<span style="color:rgb(74,85,219);">)</span>;

a <span style="color:rgb(92,92,92);">=</span> fft<span style="color:rgb(74,85,219);">(</span>y,<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>;</pre></div></div></body></html>