Numerical Accuracy Issues - Possible coding bug?

You pictures don't help much, but your statement "They are no where close to accurate" indicates a programming error, not numerical precision problems.

Because of the confusing difference in array indexing between Matlab and C, you should print out values of as many variables as you have patience for, for both implementations, to determine the location of the programming error.

It is possible to have Matlab output C code but I have never experimented with that option. Generating C Code from Your MATLAB Algorithms ยป Loren on the Art of MATLAB - MATLAB & Simulink