2
votes

I am trying to solve the following differential equations on matlab. (They are the equations obtained from the yang-mills-higgs lagrangian for the hoofy polyakov monopole ansatz). This is my function file. I have two variables h and k and their derivatives w.r.t to a variable t. My x(1)=h, x(2)=k, x(3)=dh\dt, x(4)=dk\dt. All the functions have initial value 0.

    function xprime = monopole( t,x )
    %UNTITLED Summary of this function goes here
    %   Detailed explanation goes here

    xprime(1)=x(3);
    xprime(2)=x(4);
    xprime(4)=(1/(t.^2)).*((x(2).^2)-1).*x(2) + 4.*(x(1).^2).*x(2);
    xprime(3)=(2/(t.^2)).*(x(2).^2).*x(1)-(1-(x(1)).^2).*x(1)-(2/t).*x(3);
    xprime=xprime(:);




end

Now when I run the following code >

> t0=0;
    >> tf=10;
    >> x0=[0 0 0 0];
    >> [t,s]=ode45(@monopole,[t0,tf],x0);
    >> plot(t,s(:,1));

I am not getting anything. The graph window appears but it doesnt contain anything. This equations are supposed to have solutions. The dotted curves is what one should get with the curve starting from 1 is k, and from 0 is h.

enter image description here

What is my mistake?

1

1 Answers

0
votes

When this happens the first thing you should do is look at the values in the t and s vectors. In this case s(1,1) contains 0, and s(:,2:end) are all NaN. Hence nothing on the plot.

As to why this is happening, a few thoughts

  1. Are you sure that your definition of monopole is correct?
  2. Why are you showing a plot where k(0) = 1, but passing it an initial condition of k=0?
  3. Why are you using h^prime(0) = 0 initial conditions, but in the plot it looks like h^prime(0) has a non-zero slope?
  4. The term with the 1./t^2 sure looks suspicious; just think about it, at the very first step you are going to divide 0 by 0, hence NaN. Perhaps the ode solver is having a hard time with this, and another solver would work better (note: I have very little experience with ODE solvers, so take this with a big grain of salt).

Finally, to make sure you really understand how to use the ODE solver, why not start with a very simple ODE where you know the exact answer (i.e. harmonic oscillator).