Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
shafei
Posted - 11/20/2010 : 05:29:02 AM Origin Ver. and Service Release (Select Help-->About Origin): 8.1 Operating System:7 Hi, I am new to origin and trying to write a code that generates beta values (code attached) and store them in a column. The function is BetaXXXGraph(vector& x, vector& y, int N, int segment). After compiling the code, I do not know how to run this function in labtalk window in code builder even to know if it works since it has vector in its argument!! The code is supposed to randomly choose some coordinated, store them in x[i] and y[j] arrays, use some external functions to calculate a quantity and then return the value. This procedure should continue several thousand times. Any help would be really appreciated! ******************************************************************** THE CODE IS:
#include <Origin.h>
void BetaXXXGraph(vector& x, vector& y, int N, int segment) {
int i,j,k,l;
run = 1000;
vector E(2*N+1); // initialize array with energy eigenvalues
matrix<complex> Xmoment(2*N+1,2*N+1); // initialize X position matrix
vector beta;//stores all the beta values beta.SetSize(run);
for(i = 1; i < segment; i++) { C = C + sqrt((x[i+1]-x[i])^2 + (y[i+1]-y[i])^2); // loop length } C = C + sqrt((x[1]-x[segment])^2 + (y[1]-y[segment])^2); // adding the length //of the last segment
for(i = -N; i<=N; i=i+1) //loop extends over 2N+1 state, N is # of excited states {
E[i] = EnergyLoop(i, C);// hbar = m = 1
for(j = -N; j<=N; j=j+1) { Xmoment[i][j] = XnmWireLoop(x, y, i, j); } }
for(i = -N; i<=N; i=i+1)
// Diagonal moments need ground state moment to be subtracted in // order to calculate ReBetaSOS { Xmoment[i][i] = Xmoment[i][i] - Xmoment[0][0]; }