To answer this question, I need more information than you have provided. A copy of a waveform and a copy of the generated waveform would be nice. In addition, the complete parameter set used to take and generate the data would help. If you look at the generated data on a scope, does it look correct? Here are some reasons you may be getting problems:
- The arb is being run at 40kHz (or some multiple thereof) and your FFT based frequency measurement is picking up the transitions between levels of the arb. Try either turning the filters on (on the arb) or limiting your analysis to the frequency range you are interested in. Make sure the data looks reasonable.
- The arb or scope is not taking data or generating data at the frequencies you think it
is. IVI based drivers (as both of these are) coerce setup values to possible values. Query the driver after you commit (actually take data or generate data) for the actual values used. This is probably not your problem, but you should check if you are interested in exact frequencies.
- You have a mismatch between your data file and the read code, so are reading incorrect values. I suspect you have already beat this one to death, but I have to mention it for completeness.
If this doesn't help, post some more info and let us know where you stand. Good luck.