| Author |
Comment/Response |
Shawn
|
06/19/07 12:04pm
Hi,
I am using NDSolve for a system of 2 ODEs. The following code finds the solution for B0 and B1 at t=200 for m0=0.2, 0.3, 0.4, 0.5.
J = 100;
m1 = 0.2;
e1 = 0.1;
dB0 = J - m0*B0[t] - B0[t]*B1[t];
dB1 = e1*B0[t]*B1[t] - m1*B1[t];
Flatten[Map[({B0[200], B1[200]} /. #) &,
Table[sol[m0] =
NDSolve[{B0'[t] == dB0, B1'[t] == dB1,
B0[0] == 1, B1[0] == 1}, {B0, B1}, {t, 0, 200}], {m0, 0.2, 0.5,0.1}]], 1] // Transpose
I want to calculate a Pearson correlation between B0 and B1 between time x and y (e.g., Correlation between t= 100 and 500). Can this be done in Mathematica? If this can't be done in Mathematica, how can I output my NDSolve results into a format that I can use in another program? Ideal format being a table with Columns for each m0 value and sub-columns for the values of B0 and B1 for each m0. I've tried something like this but I can't quite get it.
A = Flatten[Table[Evaluate[({B0[t], B1[t]} /. sol[m0]), {t, 0, 200}], {m0, 0.2, 0.5, 0.1}] // Transpose, 2]
Export["A.csv", A]
Thanks!
URL: , |
|