Items tagged with ode ode Tagged Items Feed

Solve Differential Equation...

September 25 2013 yangtheary 60

Solve Differential Equation :(3x-y)*dy/dx=2x

Further tags : implicit form, Matlab codegen for GPOPS purposes

Hi there,

I would like to introduce my self and ask you for an advice. 

I have a four linked robot that i would really like to control by the meaning of the optimal control theory. The arm has 4 actuators (giving torques U) in corrispondence of 4 rotational joints. P parameters describe the system.

I got ht edynamic system with the Lagrangian method and now I have 4 2nd order...

Hi, I have a maple project and one of the questions reads: 

a. | Initially, a 100 – liter tank contains a salt solution with concentration 0.5 kg/liter. A fresher solution with concentration 0.1 kg/liter flows into the tank at the rate of 4 liter/min. The contents of the tank are kept well stirred, and the mixture flows out at the same rate it flows in.
i. Find the amount of salt in the tank as a function of time.

ii. Determine the concentration of salt in the tank at any time.

Below is my code for solving a solution of three first order ODEs using the 4th-order Runge-Kutta method.

I have been able to successfully plot the solutions of each of the ODEs (x,y,z) against time t, however I am struggling to produce a plot in the three dimensional phase domain of x,y,z. Could anybody suggest what commands to use as everything I have tried (plot, plot3d, implicitplot3d etc) has produced an error. 

h:= 0.01:
N:= 200:

The damped driven pendulum is modeled using :

d2(x)/d(t2) + b*d(x)/d(t) + sin(x) = F*cos(x).  (4)

Numerically simulate (4) with b=0.22 and F=2.7

a) Starting from any reasonable initial condition, perform a phase portrait analysis. Show that the time series has an erratic appearance, and interpret it in terms of the pendulum's motion.

b) Plot the Poincare section by sampling the system whenever  t=2*pi*k, where k is an integer.

 d^2(x)/d(t^2) + sin(x)=0  (1)

d^2(x)/d(t^2) + x = 0 (2)

d^2(x)/d(t^2) + ( x - (x)^3/6) = 0 (3)

1) Compare the results of numerical simulations of (1), (2), (3) to see how closely the period of the periodic orbits relate.

a) Perform a phase portrait ( (x)'(t) vs. x ) analysis for (1), (2), and (3).

b) Consider the initial conditions x(0)= x0 and x'(0)=0. For what intervals of x0 do the periodic orbits of (2...


I am trying to plot solution of ode0 together with the maximum and minimum values but I am having difficulty since the first plot is a solution and second is values. I should have a plot with two line one represent the solution of ode0 and second (the max an min). Any advise or suggestion?

This is the code:

> restart;
with(DEtools); with(plots); Nsols := 5; Ntstep := 10;
 k := 0; A := 0.37e-1; B := 0.2e-6;
ode0 := diff(U(t), t) = -(A+B*U(t))*U(t);

part of my codes are:
func[1] := (1/2)*(c+s)*x[1]+s*x[3]+(s-c)*x[1]*x[2];
func[2] := (1/2)*(c-s)*x[1]+s*x[3]+(s+c)*x[1]*x[2];
func[3] := -b*x[2]-x[1]^2;
They are just three ODE , how to fix the error?Where is the so-called recursive assignment...?
The program works well when:
"func[1] := x[2] + (x[1]^2 - x[1]*x[3]);
func[2] := - x[1] +  (x[2]^2 + x[1]*x[4]) + x[2]^3;

I was trying to solve for the equilibrium points for a system of differential equations.  Solving for the last equation, I encountered an error that I can't seem to find anywhere else.  "Error, (in Engine:-Dispatch) not implemented yet: 13". The code is below if anyone wants to take a go a figuring what's up.  Thanks!




I am trying to get a shaded area in my plot but I could not.

First we solve ODE without randomness:

ode := diff(U(t), t) = -(A+B*U(t))*U(t);

Then we add randomness to ODE and solve:

ode2 := diff(U(t), t) = -(A+r(t)+B*U(t))*U(t);

A with randomness for r in R=( - 0.0001/365, 0.0001/365) is:

A(t,r)= A+r

Where A is constant =  0.0001/365

We plot both solution. For the plot I...

Hi all I have the following ODE

ODE_1:=diff(w(r),r)+R*(diff(w(r), r))^3=K/r;

ODE_T_1:=collect(algsubs(w(r)=u(r)+(r-1)*(U-0)/(delta-1), ODE_1),diff(u(r), r)) ;


 and when I try to do the following integration,

eq1:=int(phi[i](r)*ODE_T_1, assuming delta > 1;

it gives the following error


Error, (in assuming) when calling 'int'. Received: 'wrong number (or type) of arguments:

The system of ODEs i am trying to analyse is just a 3d model of a ball in motion with gravity and air resistence acting upon it.



eq1 := diff(x(t), t, t) = -k*sqrt((diff(x(t), t))^2+(diff(y(t), t))^2+(diff(z(t), t))^2)^(n-1)*(diff(x(t), t))

eq2 := diff(y(t), t, t) = k*sqrt((diff(x(t), t))^2+(diff(y(t), t))^2+(diff(z(t), t))^2)^(n-1)*(diff(y(t), t))

eq3 := diff(z(t), t, t) = -g-k*sqrt((diff(x(t), t))^2+(diff(y(t), t...



I have two separate procedures, one which solves a series of ODE's using the midpoint runge-kutta method, and one which solves using the Taylor expansion.

I am able to graph the two results (Q1 vs time) on separate graphs within the procedure, however after "end proc" I can't retrieve the figure or plot the two seperate results on the same graph to compare the values.

Is there an easy way of doing this or do I have to rewrite the procedure to include both methods?

Hi, I am trying to plot a solution curve on a vector field with an initial condition of y(0)=0 and I keep getting error messages. This is what I have so far:


with(DEtools); dfieldplot(diff(y(x), x) = x^2+y(x)^2-1, y(x), x = 0 .. 5, y = -1 .. 5, arrows = line, title = 'Slope*Field');


Thank you. 


After upgrading to Maple 16.02, the Maple code:


produces the directions field but fails to produce the solution curves.

I have tried the same code on two different machines running Maple 16.02 with identical results.  I have also tried the code on Maple 16.01.  In this case the solution curves are produced.

5 6 7 8 9 10 11 Last Page 7 of 18