I am writing a transformation and attempting to reverse the process. I alter the "data" array, write the array to a file, then I read the file and reverse the transformation. The file is read successfully, I am sure of it. However, the reverse transformation does not yield the original "data" array. The only changing variable besides the array values are the for loop "t" variables.
Code:
if (ffit) {
for(int t=0;t<np;++t) {
fitvalue[t]= short (data[t]-(28000+(t>=to&&t<=to1)*amp*exp((t-to/tau))));
ft=&fitvalue[t];
fwrite (ft,2,1,ffit);
}
}
// Test fit recovery
if (frecovery) {
for (int t=0; t<np; ++t) {
rcv=&recovery[t];
recovery[t]= (recovery[t]+(28000+(t>=to&&t<=to1)*amp*exp((t-to/tau))));
fwrite(rcv,2,1,frecovery);
}
}