Hello, I am trying to fit a sine function to a general curve. Convolution isn't giving me what I want, which is for every point on a general curve, displace that point by another function. I have written some code in Octave, and it's close, but not quite it. What I did was to take a general function, take it's derivative at each point, took the inverse reciprocal for the slope of the perpendicular line to that point, set the distance to the point I wanted, then put the perpendicular line in point slope for to solve for the points of interest. The plot come close, but at the derivative approaches zero, so do the perpendicular points. Code (Text): theta=[-2*pi:2*pi/1000:2*pi];#domain z=4*theta.^3-36*theta.^2+14*theta+4;#general function dz=12*theta.^2-72*theta+14;#derivative d=0.5*cos(36*theta);#distance x=((d.*dz)./(sqrt(dz.^2-1)))+theta; y=-((x-theta)./dz)+z; figure hold on #plot(theta,z)#un-comment for general plot. plot(x,y) hold off What am I missing?