I know that this a very vague question, but I am quite lost in this aspect, so I am asking for some help to begin to try to solve a second order differential equation. My second-order differential equation has the following functional form: d^2 phi (t)/dx^2+OmegaR^2/4*sin(4*phi(t))-2*Omegae*gamma*(Hy*cos(phi(t)-Hx*sin(phi(t)))+2*Omegae*alpha*dphi(t)/dt. I know which are my initial conditions, phi(t=0)=0, dphi(t)/dt (t=0)=0. Even I know which is the value of my coefficients OmegaR, Omegae, gamma, Hy, Hx and alpha for each value of an external temperature, let's say, temperature, Temperature variable, not involved in the second-order differential equation. So at the end, I want to solve that second-order differential equation in a certain time (t) interval, and plot it. It would be great if in a future I can do implement all the solutions for all the temperatures in a single plot indicating in a legend for which temperature each line corresponds, but that it is other stage of the problem. I have read the documentation of MatLab, and some posts, but I am quite lost, certainly. Someone can give an example and a strategy from which I could begin?
Also I would want to give a time-dependence to H_x and H_y, like being linear in a certain time interval H_x=k*t, given a k value, and after reaching a certain value, to be constant the rest of the time imposed in the process of solving the second-order differential equation.
Thank for your attention.
Edit: Here I present my approach until now
First, I create a function file, with all the parameters defined for a certain value of the external parameter temperature (Temperature), equal to 0. First, I am not sure if I have to upload the values in my function file (I mean, OmegaR, Omegae, gamma, Hy, Hx and alpha, because I the generalized case I will have to load a file which will contain these values for different value of temperature, which I have to remember that it is distinct to phi and time (t)):
After that, I can solve my equation for a certain time interval:
close all force
No error occurs. But I am not sure why X is an array of 40001x2 elements, what it is in each column? The first one phi and the second one its first derivative? Moreover, as I have said, this for the more simplified case of a single set of parameters for a certain value of the external parameter temperature, so I was wonder how to confront the situation in which I have multiple values for the aforementioned parameters.
Moreover, I am interested in how to implement the solution of my second-order differential equation without specifying a priori the values of Hx and Hy, because I want to take control on each of them each time that I run the program. It would be great if I run the program and MatLab ask me which value of Hx and Hy I want to use.