Mechaero2006
Aerospace
- Jan 26, 2014
- 29
Hello all,
I have this simple numerical problem to solve, for which I know what to do (done it in 1D) and I am only asking which -in your opinion- would be the best way to arrange and present my data in order to plot them using gnuplot or similar. A brief description of the problem follows:
A nxn grid will be created, say 41 points on x axis and 41 points on y axis. The initial values for our function will be stored in a 41 x 2 array (call it u(i,j)). Conditions applied on x,y axes values will apply on u. Thus we will have the x,y coordinates and two columns of "zeros" for the corresponding u(i,j) values. Then the numerical scheme will be applied to solve the problem. Something like: u(i,j) = 2*u(i-1,j-1) +.... etc.
My first thought is to create a single matrix with four columns: x, y, u(i), u(j).Then store the initial values and write the code to solve the problem. Is that OK? Would it be better to have separate arrays to store the values for x,y and u?
I sincerely hope that the description of the problem does not cause any confusion. If so, please ask for clarifications.
Thank you in advance for your assistance.
I have this simple numerical problem to solve, for which I know what to do (done it in 1D) and I am only asking which -in your opinion- would be the best way to arrange and present my data in order to plot them using gnuplot or similar. A brief description of the problem follows:
A nxn grid will be created, say 41 points on x axis and 41 points on y axis. The initial values for our function will be stored in a 41 x 2 array (call it u(i,j)). Conditions applied on x,y axes values will apply on u. Thus we will have the x,y coordinates and two columns of "zeros" for the corresponding u(i,j) values. Then the numerical scheme will be applied to solve the problem. Something like: u(i,j) = 2*u(i-1,j-1) +.... etc.
My first thought is to create a single matrix with four columns: x, y, u(i), u(j).Then store the initial values and write the code to solve the problem. Is that OK? Would it be better to have separate arrays to store the values for x,y and u?
I sincerely hope that the description of the problem does not cause any confusion. If so, please ask for clarifications.
Thank you in advance for your assistance.