Matlab problem for implicit differential equation

In summary, the speaker is trying to solve a set of implicit differential equations and is using the decic function in MATLAB to find consistent initial conditions. However, they are facing an error message because they have too many components in their z0 and zdot0 vectors. They are seeking help to resolve this issue.
  • #1
oby7842
11
0
I am trying to solve set of implicit differential equations. But first...i need to find out the consistent initial conditions for my problem( initial condition for derivative). that's why i am using 'decic' built-in function of matlab. But facing following problem. My set of differential equations function is :

function res=sample(t,z,zdot)


res=0;

res=[zdot(1);zdot(2)]-[z(2); -1.96*sin(z(1))];



script file from which I am running 'decic' function is as follows:



clc;

clear;


tspan=[0:2:20];

z0=[1;0];

t0=[0;0];

zdot0=[0;0];

[z0,zdot0]=decic('sample',t0,z0,1,zdot0,0)



but I am getting following error message:



? Error using ==> decic at 45
Cannot specify more than 2 components of y0 and yp0.

Error in ==> solver_sample at 8
[z0,zdot0]=decic('sample',t0,z0,1,zdot0,0)


Can't I solve consistent initial condition's with decic function??

I will appreciate any help regarding this. thanks for reading my problem.

regards
Omar
 
Physics news on Phys.org
  • #2
Yes, you can solve consistent initial conditions with the decic function. It looks like you have too many components in your z0 and zdot0 vectors. The decic function expects 2 components for each of these vectors, so make sure that you are only providing 2 components for each.
 

Related to Matlab problem for implicit differential equation

1. What is an implicit differential equation in Matlab?

An implicit differential equation in Matlab is an equation that involves both dependent and independent variables, where the dependent variable is not explicitly expressed in terms of the independent variable. This means that the equation cannot be solved for the dependent variable in terms of the independent variable.

2. How do you solve an implicit differential equation in Matlab?

To solve an implicit differential equation in Matlab, you can use the ode15i function. This function uses an iterative method to solve the equation numerically. It requires an initial guess for the solution, and will refine this guess until it reaches a desired level of accuracy.

3. Can you give an example of an implicit differential equation in Matlab?

One example of an implicit differential equation in Matlab is the Van der Pol oscillator, which is described by the equation x'' - mu(1-x^2)x' + x = 0. This equation cannot be solved explicitly for x, so it must be solved using an implicit method like ode15i.

4. What are the limitations of solving implicit differential equations in Matlab?

One limitation of solving implicit differential equations in Matlab is that it can be computationally expensive, especially for stiff equations. Also, the accuracy of the solution depends on the initial guess provided, so it may require some trial and error to find a suitable solution.

5. Are there any alternatives to using ode15i to solve implicit differential equations in Matlab?

Yes, there are other methods for solving implicit differential equations in Matlab, such as ode15s and ode23s, which are designed specifically for stiff equations. Additionally, you can also use symbolic math tools in Matlab to analytically solve some implicit differential equations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
951
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • Calculus and Beyond Homework Help
Replies
7
Views
336
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
Back
Top