Hey, I have to model a projectile for some work for school (by solving an ode). I have successfully done so using Euler's methods, but am also required to solve them using the Runge Kutta method. This is where I run into a problem. The derived 4th order Runge Kutta method requires that the inputs for your function of acceleration look something like this FUNCTION(time increment,distance,velocity), my function for acceleration however is more like FUNCTION(time increment, velocityx , velocityy). I work out the distance traveled by the projectile afterwards. this works fine for Euler's but not for the Runge Kutta method. Is there a derivation of it that would allow me to calculate it with the inputs I have? This is my code for the runge kutta method: % Move the problem one step forward in time using Runge Kutta function [x, xd, xdd] = oneStepRungeKutta(t, x, xd, tInc) %Calculate current acceleration xdd = acceleration(t, x, xd); %Calculate next displacement and velocity A=(tInc/2)*(acceleration(t,x,xd)); Beta=(tInc/2)*(xd+A/2); B=(tInc/2)*(acceleration(t+tInc/2,x+Beta,xd+A)); C=(tInc/2)*(acceleration(t+tInc/2,x+Beta,xd+B)); Delta=tInc*(xd+C); D=(tInc/2)*(acceleration(t+tInc,x+Delta,xd+2*C)); x = x + tInc*(xd+(1/3)*(A+B+C)); xd = xd + (1/3)*(A+2*B+2*C+D); but it requires my acceleration funtion to be in the form of FN(t,x,xd) and I want it to be in the form of FN(t,xd,xy). Is this even possible? This might not make any sense! If that is the case, I'm sorry. Its probably that try as I might I cannot get my head around the Runge Kutta method. Any help or input would be greatly appreciated. Thanks!

0 |

12/5/2010 7:17:05 AM

Hey, I have to model a projectile for some work for school (by solving an ode). I have successfully done so using Euler's methods, but am also required to solve them using the Runge Kutta method. This is where I run into a problem. The derived 4th order Runge Kutta method requires that the inputs for your function of acceleration look something like this FUNCTION(time increment,distance,velocity), my function for acceleration however is more like FUNCTION(time increment, velocityx , velocityy). I work out the distance traveled by the projectile afterwards. this works fine for Euler'...

Dear all, I am trying to solve PDE's by discretizing the space domain equations using finite difference scheme (method of lines) and solving the resultant ode's using ode solver ode15s. I am facing two problems 1. Warning: Failure at t=3.834179e-13. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.362174e-27) at time t Even if I reduce the absolute and relative tolerances, I am not able to solve this problem 2. I am trying to look at the time taken by individual expression in the code using the inbulit utility profile. The ti...

Hi all! I'm trying to solve a ODE with RK4 method,but i can't get the solution. The differential equation of the considered non-linear system is given by: m*d^2y(t)/dt^2+c*dy(t)/dt+k1y(t)+k2y(t)^2+k3y(t)^3=u(t) in which m,c,k1,k2,k3 are all constants and input u(t) is given by: 3*[sin(110*pi*t)-sin(60*pi*t)]/(2*pi*t) t=-511*0.005 sec,.....,512*0.005 sec I have to obtain the output y(t) using RK4 method,here is my code: (1) write ode file first(de1.m) function de=de1(t,Y); % Y is a column vector global m c k1 k2 k3 y=Y(1,:);v=Y(2,:); ...

the equation is M x''+ C x' +K x=f(t) Hi, pls goto http://mail.bris.ac.uk/~aemtak/numint/numint.html On 21 Dec 04 08:05:10 -0500 (EST), Lijun wrote: >the equation is > >M x''+ C x' +K x=f(t) ...

please could anyone help me...I am looking for a MATlab code to solve ODE using consistency(solid) and non-consistency numerical methods..if anyone has some examples for me I would be grateful...Thanks ...

Hi all, I have a problem with a function used to define a 2nd order nonlinear ODE for ode45. The function goes like this: function [Rdot] = km2bode(t,R) Rdot(1) = R(2); Rdot(2) = %a complicated expression dependent on some variables, such as R(1) and R(2). Rdot = Rdot'; The problem is I need the values of Rdot(2) as the time progresses later in my calculation. However if I run something like: options = odeset('RelTol',1e-10,'AbsTol',1e-10); [T,R] = ode45('km2bode', timespan, [ km.r0 initVelo], options) The values of Rdot(2) will not be saved...

dear friends, i have a small problem. i want to solve a set of9 differential equations using MOL for visualization of a field in space and time. i am using interp1 function to insert a time dependant function into a differential equation which is solved by an ODE solver. below is a part from my code, k_p=interp1(t1,k_p,t); dydt(1)=(gamma_31/2)*y(3)+(i/2)*(k_p+k_d).*y(7)-(i/2)*(k_p+k_d).*y(4); if i run the ODE solver for the given number of space points and insert the interp1 function like this, will this work correctly? i have ran my program but i think the result is not correct. i ...

I need to interpolate some data to use in a system of ODEs and then solve the system (using ode45, or similar). On the MathWorks documentation (see the main page on solving ODEs), they have a solution with the interpolation in the definition of the ODE. I can do this, however, I need to repeatedly call the ODE as part of a (fminsearch) parameter search. I belive that the computation would be faster if the program could do the interpolation once, outside of the ODE, instead of every time the ODE is called. I've tried several methods of creating a function (or script) that interpolates...

Dear friends I have a coupled ODEs, In[1]:= e1 = x1[t]* (-27 + 4 x1[t]^2) - 4 (1 + x1[t]^2)* y1'[t]; In[2]:= e2 = y1[t] *(-27+ 4 (x1[t]^2 + y1[t]^2)) + 4 (1 + x1[t]^2 + y1[t]^2) *x1'[t]; Given the initial values of x1[0] and y1[0],we can use NDSolve command to solve them In[3]:= s=NDSolve[{e1==0,e2==0,x1[0]==1,y1[0]==0},{x1,y1},{t,0,20}]; Now I want to solve them using another way( Because they are the simplest cases. The actually form I have to deal with can not be obtained obviously). At first I generate the data for the fist part of right hand side(RHS) of e1 as I...

Could someone please elaborate on how to use ODE 15s or 45 for this differential equation? (1/beta) *(d alpha/dT) = ln A*(1-alpha)- (E/RT) I have the value of alpha and E as a function of a. I need to generate graph of alpha Vs Temperature and d alpha/dT versus Temperature. On 6/24/2012 7:59 PM, Sriraam wrote: > Could someone please elaborate on how to use ODE 15s or 45 for this differential equation? > > (1/beta) *(d alpha/dT) = ln A*(1-alpha)- (E/RT) > > I have the value of alpha and E as a function of a. > > I need to generate graph of alpha Vs Tempera...

HI Please i want to know how to register my new MATLAB program which solve wide range of ODE, and what is the advantages which i will obtain from mathworks if there is a gournal which i must send my program first to it,what it is name many thanks ...

Hey all, I've tried posting this before, but I did not have much luck with the help given. I've decided to post all that I have and to let someone help me on this. I'm a chemical engineering student, not a computer scientist, which may be half my problem, but thank you all in advance. ***Basically, I would like to be able to solve my differential equations at specific points in time so that I can compare it to the "Data for comparison" below. I have been told feval is the built in function to use, but I have been having real difficulties trying to use it in that manner....

Hi, I would be thankful for some help on this: I am trying to solve coupled pde problem using method of lines. Therefore I end up with a large system of odes. Is it possible to use distributed computing to solve this large system of ode in Matlab to increase efficiency? Searching through the newsgroup I have not seen anything that helps. Thanks Mmd. On Nov 4, 10:01=A0am, "Mmd " <hp...@newcastle.edu.au> wrote: > Hi, > I would be thankful for some help on this: > > I am trying to solve coupled pde problem using method of lines. =A0Theref= ore I end up with a l...

Hi, I've been tasked with analyzing the motion of a mass suspended from two spring, oscillating vertically. I've constructed the equation of motions for the two generalized coordinates, but when I run them though a odesolver I get the following warning messages "Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.356722e-23" "Warning: Failure at t=2.584356e-01. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (9.181478e-16) at time t" The matlab code is as follows. The func...

Hello, I'm trying to solve a system of five 5 differential equations: 2 ODEs and 3 PDEs. Pdepe keeps giving me the error "This DAE appears to be of index greater than 1" and I'm not sure if it's a bug in my code or if the problem I'm trying to solve isn't possible in Matlab. My code is below and any advice or insights you could give on how to proceed would be much appreciated. Thank you, Layla ----- function solve_pde m = 2; r = 0:0.05:2; t = 0:10:200; sol = pdepe(m,@pde,@pde_ic,@pde_bc,r,t); u1 = sol(:,:,1); u2 = sol(:,:,2); u3 = sol(:,:,3); u4 = sol(:,:,4...

I have a second order ODE (ordinary differential equation): x_doubledot + x_dot*0.25 - x + x^3 = 0.3*cos(t) where: x(0)=0 , x_dot(0)=1 and 0<=t<=60 s I need to solve this using ode45. Anybody up to doing this? I'm new at this and have no idea. Cheers "Grant W" <grant_wilburn@hotmail.com> wrote in message news:ef1781e.-1@webx.raydaftYaTP... >I have a second order ODE (ordinary differential equation): > > x_doubledot + x_dot*0.25 - x + x^3 = 0.3*cos(t) > > where: > > x(0)=0 , x_dot(0)=1 and 0<=t<=60 s > > I need to solve this us...

Dear friends, Is it possible to use ode solver if my differential euqation is f(t,y,y_prime)=0? Function f includes a double intergration with it. If not possible, what other methods or combination of method may be used? Thank you very much. rayman ...

hellow , I use the legendre pseudospectral method to solve an OCP problem, this method is called like this because the states/controls are approximated by the legendre polynomial of degree N on the legendre-gauss-lobatto nodes .... ,so i use this method to transform my continuous OCP into a discrete OCP which i can solve by using the matlab function "fmincon". my problem is the following : my program is working for 10 or 20 LGL nodes, theses nodes are reals and i get the solution that i want. But!!! for 50 LGL nodes (some of the LGL nodes are complexes) my program is not converging...

Hi I have an eq. like dy/dt=y(t).y(t-t0)+g(t) t0 is constant. How should I use ODE to solve it? Dear ehsan, > I have an eq. like dy/dt=y(t).y(t-t0)+g(t) > t0 is constant. > How should I use ODE to solve it? Do you want to solve this numerically or analytically? At first you have to find out, if the problem is stiff or not. What is "g(t)"? For a non-stiff problem, see the documentation of e.g. ODE45. A stiff problem can be solved by ODE15S. Good luck, Jan On Oct 23, 3:25=A0pm, "ehsan " <hemmati2...@yahoo.com> wrote: > Hi > I have an...

Is it possible to use the distributed processing toolbox for an ode solver. My input to ode being large, it takes a large time to solve it "Rishab " <rishab.civil@gmail.com> wrote in message <god7ep$n69$1@fred.mathworks.com>... > Is it possible to use the distributed processing toolbox for an ode solver. My input to ode being large, it takes a large time to solve it Hi Rishab, were you able to find a solution to your question? i am also interested in this. ...

Hello, Say I have some equation in terms of constants a, b and c, and variables x and y(x): a*y^2*ln(y) - y^2 + b - 4*c*(y-1)*x + a*b*(y^2-1) = 0 The problem I have been given is to solve this equation for y(x) as a function of x, using the Newton-Raphson method. (I.e. solve y(x) in terms of the variable x and constants a,b,c). How do I go about doing this? I'm lost as to how to solve this using the Newton-Raphson method in particular. Thanks, Graham On Aug 31, 3:56=A0am, "Graham " <gra...@peyton.co.za> wrote: > Hello, > > Say I have some equ...

I have programed system of six coupled ode listed below in matlab.But i dont know how to solve these equations using Predictor corrector and RK-4th order method. Please help me in solving these equations. function [GG ] = myfun_rafiq(t,x) % ----- State Variables Selection % x1 = nw, x2 = Nw, x3 = nc, x4 = Nc, x5 = np, x6 = Np % ----- Parameters sigmaEjQj = 793.7; EiQi =700; EpQp = 13.7; EcQc = 80; EfQf = 0; Vc = 9.08e6; Vw = 1.37e7; Vp = 1.37e6; lk = 0.0; Kc = 40.0; Kp = 6.90; f_t = 1; sigma = 13.4e-24; fn = 1; ...

Dear Sirs, I was using my own short programs based on Runge-Kutta-Fehlberg and other methods for ODE IVP�.. In the future I would like to use the Matlab functions (ode45, ode23s�), since Matlab functions have much better step-size prediction than the ones coded by me�So, here is the question: y�=f(t,y); y(0)=y0� My problem is defined in such a way, that the function �f� is not entirely known in advance, but is calculated step by step while the solution progresses. The evaluation of the function value f is feasible only near the current step�. The function f is not analytically given, but is...

I have a problem suing the following code: Cone[beta_, v_,rcAB_,rcCD_,ax_,ay_,cx_,cy_,centerOfMassx_,centerOfMassy_] := Module[ {betaUsed, vtemp, fx, fy, ex, ey, waarde,criticalRC,criticalHeight,xVerplaatsing,ePx2Py2}, betaUsed = beta ; vtemp = v; fline[x_] := Tan[betaUsed]x - Tan[betaUsed]vtemp; fx = x /. Solve[fline[x] == cd[x,rcCD,cx,cy], x][[1]]; fy = cd[fx,rcCD,cx,cy]; criticalRC = (centerOfMassy - fy)/(centerOfMassx - fx); criticalHeight = -criticalRC*fx + fy; ex = (-ay + rcAB*ax + criticalHeight)/(rcAB + (-criticalRC)); ...

And why we use them instead of numerical ones? If you explain this question with example, it will be deeply appreciated! "Sofia Häggberg" wrote in message <ip45u1$fbr$1@fred.mathworks.com>... > And why we use them instead of numerical ones? > > If you explain this question with example, it will be deeply appreciated! Well, you might use numerical solutions when you have numerical coefficients. You might use an analytical solution when you don't. Or, not. Your question seems a bit silly to me. Suppose I asked when you would choose to fly by airplane to ano...