Solving an ODE using RungeKutta methods.


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
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.

12/5/2010 7:17:05 AM
comp.soft-sys.matlab 207118 articles. 0 followers. lunamoonmoon (258) is leader. Post Follow

0 Replies

Similar Articles

[PageSpeed] 17
Similar Artilces:

Can you solve this in matlab2009b 64 bit? (systems of equations to be solved using "solve")
Hi all, Can you solve the following in matlab 2009b 64 bit (macosx with snow leopard)? I get the errors given below the code. It takes a lot of time before Matlab gives the error. Where do I go wrong? %----------------------- syms p0 p00 p1 p2 cn cr dn dr a an ar bn br T tau real; myfun = [ -(tau*(2*an + 2*bn*cn - 4*bn*p1 - dn*tau))/2; -(tau*(2*ar + 2*br*cr - 4*br*p0 - dr*tau))/2; ((T - tau)*(T*dn - 2*an - 2*bn*cn + 4*bn*p2 + dn*tau))/2; ((T - tau)*(T*dr - 2*ar - 2*br*cr + 4*br*p00 + dr*tau))/2; an*p2 - an*p1 - ar*p0 + ar*p00 + bn*p1^2 - bn*p2^2 + br*p0^2 - br*p00^2 - bn*cn*p1 + bn*c...

Using SuSE KDE. How do I tell the system I want to use GNOME?
What I got to do? May need details. TAB wrote: > What I got to do? May need details. > I'm not an expert but assuming you have Gnome installed I would exit your KDE session (Star->logout->end session only), then on the login screen select Gnome. That's how I would do it on my system (Mandrake 10.1). But mine is graphical all the way, I don't have to startx and x never shuts down unless I tell it to. Do you have a graphical login screen? -- ----- BEGIN GEEK CODE BLOCK ----- Version 3.1 GAT d? !s !a C++++ UL+ P L++ E- W+ N+ o-- K- w-- O- !M !V PS-- PE++ Y+ ...

solve the questions
i am beginer in vc++.i want help in the following questions. 1. How can i create database program using sql server through codings.If we want DSN name it also create through codings. if u have any easy sample program please sent the following mail id. "nevis" <> wrote in message > i am beginer in vc++.i want help in the following questions. > 1. > How can i create database program using sql server through codings.If > we want DSN name it also create through codi...

how do you "properly" close ports and stop timers when using a close GUI?
So I have this simple program that takes in RS232 data and just displays it to the screen. Note this is a GUI the problem that im facing is how to stop a timer that ive set up and close any open serial ports once the program is stopped. Ive basically done this... gui-confirmation but instead of the confirmation window, Im closing ports and stopping timers with the closeGUI function. My problem is that I cant seem to figure out HOW to pass the handles to this function. set(handles.figure1,&#8217;CloseRequestFcn&#821...

Which Classic word processor should I use?
I have the latest OS X version of MS Word running on my Mac -- a G4 PowerBook running 10.3.4 (or is that 10.4) -- but I want to also use a word processor that'll run in Classic, so I can use bitmapped fonts. SimpleText won;t cut it, because it's -- well, too simple. You can't even center a paragraph of text. The two possibilities I was considering were MacWrite II and an older version of MS Word. But would an older version of Word just peacefully co-exist with the OS X version, or would there be trouble? For example -- -Would the installation process overwrite any files ne...

Audio Mixing using DSP
Hello everyone, i want to implement audio mixing for call conference wit PCM encoded voice channels, I want to know how audio mixing is done by DSP ? and any suitabl algorithm or document for it. also plz guide me how to proceed for its implementation? Thanks in advance, Rahul Jadhav. On Jul 7, 8:35=A0am, "jadhav_rahul" <> wrote: > Hello everyone, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 i want to implement audio mixing for call con= ference with > PCM encoded voice channels, > I want to know how audio mixing is done by DSP ? =A0a...

Using Python with an OLAP Server
The documentation for the latest version of an OLAP server (MIS ALEA from states that "PushRule function libraries can be developed with any development environment supporting the generation of COM components. Additionally, further libraries may be integrated with PushRules." The documentation gives examples of the use of MS Visual Basic to generate the required functions. Would anyone with experience in PythonWin be prepared to give an opinion whether, on the assumption that the documentation is accurate, it would be similarly possible to use PythonWin to develop the...

Does anyone still use (real) DEC line printers?
NB: Follow-ups set to comp.sys.dec as the most neutral place on the list. I have been asked to find out whether anyone still uses line printers on their DEC systems. I'm not sure why the question came up, exactly, though we have just sent a board design out for manufacture for a replacement M8571 (which appear to be unobtainium) in order to hook an LP27 to a 2065. -- Rich Alderson the russet leaves of an autumn oak/inspire once again the failed poet/ to take up his pen/and essay to place his meagre words upon the ...

Does anybody use System Generator for DSP 8503
Hi, I'm an Electronic Engineering student and I'm doing my Thesis using System Generator for DSP v3.1 service pack 1. I've done my model in Simulink and tested that it works. Later I generate the netlist wihtout problems but when I try to synthesize in ISE 5.1 usin the XST VHDL desing flow lots of warnings appear. Above all this warnings; WARNING:Xst:37 - Unknown property "syn_black_box". WARNING:Xst:37 - Unknown property "fpga_dont_touch". And many others like signals asigned but never used. Why is the reason this warning appear? What should I do? Anybody could...

solving an array of equations with solve
Hello, I want to find zeros of a system of equations, eq=[eq(1),..,eq(n)]. But solve(eq) doesn't seem to work here, yet solve(eq(1),..,eq(n)) does. Suggestions? Thanks. ...

Re: Do you think sas programmers should only use sas? #43 1549267
Roland queried: >I get the impression that sas programmers, more than other programmers >(except perhaps COBOL), tend to only know sas and not other languages. >Do you think this is true? And if so, is this a good thing or a bad >thing? [1] I don't get the impression that SAS programmers are that insular. I *do* get the impression that many SAS users are not programmers in the comp sci sense of the word, but that doesn't make them bad people. :-) :-) I see a lot of SPSS and BMDP and GAUSS coders who have far less experience with other languages. I even see some peopl...

Using Apache (newbie questions)
Hi all, =20 Well, playing with SAMBA wasn't frustrating enough (really love that SMBCLIENT!), so we're out to dabble with Apache. At the moment, we're reading reams of documentation from (when we can actually decipher it), but I thought that it'd be a great idea to have any on you folks let us know of any pitfalls before we get started? =20 =20 =20 TIA, =20 =20 <>=20 Ray Shahan Computer Programmer REPUBLIC TITLE OF TEXAS, INC. <>=20 ...

Need a solved genetic algorithm example problem for Optimization
Greetings. I am teaching a class on Engineering Optimization to undergraduate students. During the last week of classes, I want to cover some non-traditional optimization topics such as Simulated Annealing, Generic Algorithms, Taguchi Methods, and the like. I am looking for a fully solved example problem that uses genetic algorithms. The problem can involve any particular application - backpack problem, traveling salesman problem, and so on. It does not have to be fancy. However, I do need the m-code so that I can run it - and maybe single step in debug mode - in front of the class. Sadl...

A good reason to use structural equality
Microsoft has patented the physical equality: Those of us who use C should still be safe, since we usually say "! Is" instead of "IsNot" ;-) "Christian Szegedy" <> wrote in message news:cnl50p$oue$ > Microsoft has patented the physical equality: > > http://appf...

how to use mp3read??
Hi , I typed following code to read a mp3 song : Y=MP3READ('titanic_flute.mp3'); display(Y); and its prompting following error : ??? Undefined function or method 'MP3READ' for input arguments of type 'char'. Can anyone assist? Thnx.. "Naina Mittal" wrote in message <jmods7$jcl$>... > Hi , > > I typed following code to read a mp3 song : > > Y=MP3READ('titanic_flute.mp3'); > display(Y); > > and its prompting following error : > > ??? Undefined function or method...

Use How to use the SAME Key for another eMail address ?
Ok, I generated a PGP key (with PGP 6.5.8) for email-Adress lets say Everything is fine. At next I want to use exact the same keypair which I generated above for another eMail address e.g. How do I tell PGP to copy the existing key pair and replace the existing email-Adress by a new one? Rod ...

Allbase ISQL using 132x72 terminal
Hello! Is it possible to convince HP Allbase ISQL/9000 to work in a 132x72 mode (as opposed to 80x25)? I use VT100 settings and have COLUMNS and LINES set correctly, but ISQL doesn't seem to recognise this. -- Regards, Roman ...

reading bits using JBits 3.0
Hi, How does one read back specific bits using JBits 3.0? For example, if I want to read back the contents of the F LUT - how do i go about it? I tried jbits.getCLBBits but I get an configuration exception. Ditto with getTileBits. My sample code looks like this: int lut []; lut =jbits.getCLBBits(0, 1, LUT.CONTENTS[0][LUT.G]); Is this correct? If it is, why do i get the configuration exception? Any help on this would be appreciated. Thanks in advance, Sarnath ...

fix column width using Append Table to
Using the VI 'Append Table to' I want to set a fix column width (the best would be to set the width of each column...). By wiring the input 'column width', the widths of the columns still depend on the amount of text of the single columns. Is there a way to solve my problem? Or does anybody know, what that input 'column width' really means? Hi! You have to use propertynode of XL column. See the attachment. See the block diagram you will get idea. Jenilia D'souza Canberra Australia Exel column

4.3 Beta-Using preview causes Pegasus to abort
Hi, I just upgraded to the 4.3 Beta. I confess to being an email packrat and have several thousand messages. I was using a very old version that I had installed in early 2004; I don't remember which one. Since the upgrade when I turn on Message Preview Pegasus aborts--I get this message: Message preview is disabled because Pegasus Mail has detected that it terminated abnormally the last time it ran. If an abnormal program termination is caused by the contents of the first message in the folder being previewed (as can sometimes happen with certain types of badly-form...

step size on ODE solvers
I would like to know the step size ode113 is using at each function call (i.e., t(i) - t(i-1) instead of just t(i) ). Is there a simple way to do this? Thanks! -Chris ...

Multi-boot liveCDs solved!
Multi-boot liveCDs solved!!!!!!!! (link from Hats off to Mr. Anindya Roy for taking simple liveCDs and putting them together into different directories a big DVD and then make the DVD multi-boot so as to boot any of those liveCDs!!!!! I've been waiting a year for this solution - and its so simple! It could have (and probably have been) done ages ago. Now you can show burn a single DVD (or CD) with many liveCD distros as you want and the choose which one to run from menu. Never leave home without you...

Using fft for noise estimation
I am trying to use to find the presence of noise beyond a cutoff frequency in a signal. My approach is to normalize the power amplitude using the peak (DC) power, and then look for amplitudes above a certain threshold after the cutoff frequency. The normalization is to generalize the approach, as well as to remove the dependency on data size, since my understanding is fft introduces a 1/N factor. However, I noticed that even after normalization, the amplitudes very with data size, i.e. if I cut the signal length in half, amplitudes of PYY after 0 Hz become larger. Any comments? More specifical...

What to use?
Hello All! I've captured several TV shows to my hard drive through my TV tuner card. The files are in the .mpg format. What program would be the best to edit the commercials out and then resave as .mpg, or possibly burn to DVD? TIA, Barry Pinnacle Studio 9se will do it, if your just looking to get the mpgs on dvd. "Barry Delfino" <> wrote in message > Hello All! > > I've captured several TV shows to my hard drive through my TV tuner card. > The files are in the .mpg fo...

[ace-users] "How to Use ACE Effectively" Training Class from Riverace Corporation #2
Upcoming "How to Use ACE Effectively" Training Class: October 17-20, 2006 "What's the difference between the Reactor framework and the Proactor framework, and when should I use one or the other?" These and many other questions will be discussed and answered at our upcoming "How to Use ACE Effectively" class to be held October 17-20, 2006 in Waltham, MA (in the Boston area). This is a new, expanded 4-day class, priced at US$1,700 including continental breakfast, snacks and lunch each day. Each attendee receives a copy of the class slides and a copy...