You have differences in the transient, but the steady-state looks the same therefore it is probably a memory initialization problem in the C-code Here are a few things to check : Are you sure your input is exactly the same? Make sure your input buffer is properly initialized in the C-code. You probably have some kind of data buffer to store the previous samples. Again make sure the data is properly initialized. If the data buffer is not properly initialized you will likely have garbage in the data buffer instead of having '0' in the data buffer which would explain why the transient is different. The Matlab coder generates 3 user functions, Initialize, Step and Terminate. Make sure you call Initialize once, before make any call to Step.