function f = fsin(x,n,c) % % Find nth derivative of sin(c*x) at x % n=0 f=sin(c*x) % n=1 f=c*cos(c*x) % n=2 f=-c^2*sin(c*x) % n=3 f=-c^3*cos(c*x) % and the cycle repeats for n>3 % switch mod(n,4) case 0 %% n = 0, 4, etc. f = c^n*sin(c*x); case 1 f = c^n*cos(c*x); case 2 f = -c^n*sin(c*x); case 3 f = -c^n*cos(c*x); end