summaryrefslogtreecommitdiff
path: root/texmf-dist/scripts/ketpic/ketlib/ketpicscifiles6/Fouriercoeff.sci
blob: af2592442c958956edb2f8386632af640a8da80d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 09.03.13

function Out=Fouriercoeff(Fn,T,Ch,K)
  Eps=10^(-5);
  L=T/2;
  Tmp1='Out=FUNC(x)';
  if Ch=='c'
    Tmp2='Out=Fn(10*L*x)*cos('+string(K)+'*%pi*x*10)';
  else
    Tmp2='Out=Fn(10*L*x)*sin('+string(K)+'*%pi*x*10)';
  end;    
  deff(Tmp1,Tmp2);
  Out=10*intg(-0.1,0.1,FUNC);
  if K==0
    Out=Out/2;
  end;
  if abs(Out)<Eps
    Out=0;
  end;
endfunction;