I want to solve the equation group like
\frac{dx_1(t)}{dt}&=(1-\int_0^t x_1(t) dt)x_2+x_1;
\frac{dx_2(t)}{dt}&=(1-\int_0^t x_2(t) dt)x_1+x_2.
Can I directly use the methods in Matlab to solve this problem? I tried ode45 but failed.
I have a symbolic matrix that depends on a complex parameter q. Let the matrix be A(q) and b a column vector. I would like to simultaneously solve the equations
A*b==0; b'*b==1;
using the solve command (preferably the numerical variant vpasolve). The variables to be found are both b and q. I am not quite sure about the syntax on how to do this and would appreciate any help on it. My main problem is that the equation is partially given in matrix form and the searched variable is a vector.
Do I have to resort to fsolve to achieve this? Or is there a way without defining a function?
How can I show that y(t)=Yo/Yo+(1-Yo)e^-at is the solution of the differential equation dy/dt=ay(1-y) using MATLAB. What function should I use?
if you want to simulate the results use the ode's family
https://www.mathworks.com/help/matlab/ref/ode45.html
else you can define your equation in syms and use diff
https://www.mathworks.com/help/symbolic/diff.html
other wise you can solve it numerically
I have a system that looks like
dn/dt=f(n,v)
dh/dt=g(h,v)
I want to solve this equation on the manifold F(v,n,h)=0, a nonlinear function in v. I tried to use something like v=fzero(#(x) F(x,n,h),0) to solve for the value of v on the manifold at each time step. But this is incredibly slow and ode15s (my system is a relaxation oscillator) fails to meet integration tolerance. How do I find solution to the ODE on the manifold defined by F(v,n,h)=0?
I find #LutzL's comment very helpful. It is possible to set up a DAE solver using ode15s.
Example: The "Solve Robertson Problem as Semi-Explicit Differential Algebraic Equations (DAEs)" section in https://www.mathworks.com/help/matlab/ref/ode15s.html
In my case, I would setup a matrix:
M=[zeros(1,3);0,1,0;0,0,1];
options = odeset('Mass',M,'RelTol',1e-5,'AbsTol',1e-6,'MaxStep',0.01);
y0=[v0,n0,h0];
[T,Y]=ode15s(#slow,[0 50],y0,options);
And slow is a function defined as:
function dy = slow(t,y)
v=y(1); n=y(2); h=y(3);
dy=zeros(3,1);
dy(1)=F(v,n,h);
dy(2)=f(n,v);
dy(3)=g(h,v);
end
One of the possible ways to solve this problem is to differentiate
the F(v,n,h)=0 equation:
Now we can obtain the ODE system
or
which can be solved in the usual way.
I am trying to use matlab's fsolve to solve a system of 4 nonlinear equations. I'm solving the system for each point in a grid of parameters by looping through each point and calling the fsolve function.
My problem is that I need to give some of these parameters as input to fsolve. These inputs should be treated as constants for each separate solving of the system.
Can anyone help me?
you can just do:
result = fsolve(#(x) eqns(a,b,c,d),guess)
and in addition make the function eqns() with your equation set.