- #1
louie
- 10
- 0
Please refer to jpeg extension
I think that the following MatLab code will solve the first D.E,
>> function xdot = nlseq(t,x); % Returns the state derivative
>> R = [2 -1; 3 5];
>> L = [1 – cos(0.5*t) 5*sin(4*t); 20*sin(2*t) 3–cos(0.8*t)];
>> V = [15*sin(t); 25*cos(t)];
>> xdot = inv(L)*(V – R*X);
>> tspan = [0, 10]; % Time interval
>> x0 = [0;0]; % Initial condition
>> [t, x] = ode23(‘nlseq’,tspan,x0);
I would like to know how to incorporate the second D.E into the above code so that I can solve for both (I realize I need to make another xdot command, but I’m not sure how to do it).
Another problem that I have is that I want to plot y vs w, where w is the solutions from the second D.E and y is shown on the jpeg extension,
So basically I want to take my solution (at every interval) from solving the first D.E. and transform it through the matrix shown on the extension. I would think that I need to write some kind of loop, but I’m not sure how to do it.
Any help with the above problems would be greatly appreciated
I think that the following MatLab code will solve the first D.E,
>> function xdot = nlseq(t,x); % Returns the state derivative
>> R = [2 -1; 3 5];
>> L = [1 – cos(0.5*t) 5*sin(4*t); 20*sin(2*t) 3–cos(0.8*t)];
>> V = [15*sin(t); 25*cos(t)];
>> xdot = inv(L)*(V – R*X);
>> tspan = [0, 10]; % Time interval
>> x0 = [0;0]; % Initial condition
>> [t, x] = ode23(‘nlseq’,tspan,x0);
I would like to know how to incorporate the second D.E into the above code so that I can solve for both (I realize I need to make another xdot command, but I’m not sure how to do it).
Another problem that I have is that I want to plot y vs w, where w is the solutions from the second D.E and y is shown on the jpeg extension,
So basically I want to take my solution (at every interval) from solving the first D.E. and transform it through the matrix shown on the extension. I would think that I need to write some kind of loop, but I’m not sure how to do it.
Any help with the above problems would be greatly appreciated