# Solving a system of differential equations whose one of the coefficients is imported data

Suppose we have a coupled system of differential equations: $$$$\frac{db}{dt}=(- \gamma_b -i\omega_b)b-i\frac{g}{2}p;\quad \frac{dp}{dt}=i\frac{g}{2}\Delta N(t) b-(\gamma_a+\gamma_b+2iJ)p.$$$$ If $$\Delta N$$ was fixed, the solution of the system would be like $$$$\begin{pmatrix} b(t)\ p(t) \end{pmatrix}=\begin{pmatrix} a_{11}&a_{12}\ a_{21}&a_{22} \end{pmatrix}\begin{pmatrix} b(0)\ p(0) \end{pmatrix}$$$$ Using the following code, I have found a $$2\times 2$$ matrix (called sol) whose entries are $$a_{ij}$$ in the above equation:

rb=630;wb=75*10^6;g=0.63;ra=2.6*10^6;rm=3.6*10^6;J=6.3*10^7;DeltaN=0.164*10^5; m ={{-rb-I wb,-I g/2},{I g DeltaN/2,-(ra+rm+2 I J)}}; eigvec = Eigenvectors[m] // Transpose // Simplify; eigval = Eigenvalues[m] // Simplify; inv = Inverse[eigvec] // Simplify; v1 = eigval[[1]]; v2 = eigval[[2]]; sol = eigvec.{{E^(v1 t), 0}, {0, E^(v2 t) }}.inv; 

If we suppose that $$p(0)=0$$, then one can easily plot $$|b(t)/b(0)|^2$$: simply plot $$a_{11}(t)$$. But the problem is that $$\Delta N$$ is not fixed. It is a $$N\times 1$$ matrix which I have obtained from another code written with Fortran and its type is data.txt. The elements of this file are calculated by assuming the time interval between each one is $$0.001$$. That is, for $$t=0.001$$ we have $$\Delta N_1$$, for $$t=0.002$$ we have $$\Delta N_2$$, etc. But the time intervals are not included in the txt file.

One way that comes to my mind is this: Assuming we know the analytical form of solfor a fixed $$\Delta N$$, we set time, i.g., equal to $$0.001$$ and then substitute the first row of the txt file (I call it $$\Delta N_1$$) into sol and find $$a_{11}$$. Then we raise time to $$0.002$$, substitute $$\Delta N_1$$ into sol, find $$a_{11}$$, and repeat the procedure to the last row of the txt file.

Now the question is this: how can I import the txt file to the code and do the procedure that I explained above to get some data like $$\{\{0.001,a11(0.001)\},\{0.002,a11(0.002)\},….\}$$ where the first elements are time intervals and the second ones are $$a_{ij}$$ corresponding to that particular time?

I had asked a similar question here enter link description here, but in that problem I did not have an external file with txt format.

I could not upload my txt file, so I write the first 10 elements if necessary:

0.164E+05

0.655E+05

0.146E+06

0.258E+06

0.400E+06

0.572E+06

0.776E+06

0.101E+07

0.129E+07

0.159E+07