Sin function returns NaN

I’m trying to figure out why this function is returning a NaN value for v3.y. The object of the script is to move the “centerPoint” up and down using the sin. Whenever the script runs from the beginning of the scene this code throws a NaN error. However if I enable the script after the scene is run it works without throwing an error. I’m guessing it may be because centerPoint starts at 0, but I am not sure. Seeking guidance and help!

Vector3 v3 = centerObject.localPosition;
v3.y = Mathf.Sin(Time.time * _frequency + phase + (centerPoint / width)) * amplitude;   
centerObject.localPosition = v3;

Often NaN’s happen when you divide by 0. Make sure your width is set before the first time the function executes (try adding a Debug.Log(width) right before your code)