view funm_files/fun_sin.m @ 8:a587712dcf5f draft default tip

funm_atom.m: rename fun_atom to funm_atom * funm_atom.m: rename fun_atom to funm_atom.
author Antonio Pino Robles <data.script93@gmail.com>
date Fri, 29 May 2015 09:48:36 +0200
parents 8f23314345f4
children
line wrap: on
line source

function f = fun_sin(x,k)
%FUN_SIN

if nargin < 2 | k == 0
   f = sin(x);
else
   k = k - 1;
   g = mod(ceil(k/2),2);
   h = mod(k,2);
   if h == 1
      f = sin(x)*(-1)^g; 
   else
      f = cos(x)*(-1)^g; 
   end
end