I am numerically simulating the Mathieu equation using ODE45 and I have to keep changing the parameters delta and epsilon for each simulation to get the required peiodic solution.
Following is the MATLAB code I am running:
function xdot=trial2(t,x) delta=0.1045;epsilon=0.0048685; xdot=[x(2);(-delta-epsilon*cos(t))*x(1)-0.7*delta*abs(x(1))]; [t,x]=ode45('trial2',[0 10000000],[0;1]); hold on; plot(t,x(:,1),'r'); clear all;
It is taking me 10 minutes for each simulation if I simulate for 10000000 time and it doubles if I increase the time 5 fold. After each simulation, I analyze the result and change the parameters accordingly so that I can come closer to a periodic solution. I have to do this for maybe about 30-40 parameters maybe more. I am running this on a 64 bit desktop with 8gb ram. The program runs out of memory on a 32 bit desktop.
1) Is there somehow I can improve my computational time? I might have to go from 10000000 to 50000000, maybe even more. 2) Can you help me out in implementing the parfor loop so that I can run simultaneous simulations for more number of parameters. That might be of some help too.3) WIll it help if I run this on a faster processor than i5-2400 CPU?