SINAD calculation in MATLAB
Is what I am doing correct?

Yes

If not, how would I reproduce the SINAD function?

By replicating the exact same algorithm that the Matlab function uses.
Your answer is more correct, but you also &quot;cheated&quot;. You have access to the original sine and noise signals. sinad() ONLY has access to the sum of both. Hence it needs to do an estimation using windowing and Periodogramm analysis. That's less precise than calculating it directly from the original signals. If you really want to replicate what sinad() is doing, try an algorithm that only uses the combined noise+sine signal.