R
Rhybec
Can anyone tell me why this works:
for (i=0;i<nx;i++) {
for (j=0;j<ny;j++) {
R[i,j]=-1*A*exp(-1*(pow(X-Xc,2)+pow(Y[j]-Yc,2))/(2*sig));
fprintf(Rfile,"%f %f %f\n",X,Y[j],R[i,j]);
}
}
And this does not?
for (i=0;i<nx;i++) {
for (j=0;j<ny;j++) {
R[i,j]=-1*A*exp(-1*(pow(X-Xc,2)+pow(Y[j]-Yc,2))/(2*sig));
}
}
for (i=0;i<nx;i++) {
for (j=0;j<ny;j++) {
fprintf(Rfile,"%f %f %f\n",X,Y[j],R[i,j]);
}
}
I may be missing something, but I have been perplexed for hours. The
second example outputs a completly wrong value for R.
Thanks,
Rob
for (i=0;i<nx;i++) {
for (j=0;j<ny;j++) {
R[i,j]=-1*A*exp(-1*(pow(X-Xc,2)+pow(Y[j]-Yc,2))/(2*sig));
fprintf(Rfile,"%f %f %f\n",X,Y[j],R[i,j]);
}
}
And this does not?
for (i=0;i<nx;i++) {
for (j=0;j<ny;j++) {
R[i,j]=-1*A*exp(-1*(pow(X-Xc,2)+pow(Y[j]-Yc,2))/(2*sig));
}
}
for (i=0;i<nx;i++) {
for (j=0;j<ny;j++) {
fprintf(Rfile,"%f %f %f\n",X,Y[j],R[i,j]);
}
}
I may be missing something, but I have been perplexed for hours. The
second example outputs a completly wrong value for R.
Thanks,
Rob