Question

In: Physics

Solve Kepler's Equations Using Euler's Method in matlab.

Solve Kepler's Equations Using Euler's Method in matlab.

Solutions

Expert Solution

The following is a Matlab program to solve differential equations numerically using Euler's Method . I will explain how to use it at the end:


The Program:

%function t=t(n,t0,t1,y0)
function y=y(n,t0,t1,y0)
h=(t1-t0)/n;
t(1)=t0;
y(1)=y0;
for i=1:n
t(i+1)=t(i)+h;
y(i+1)=y(i)+h*ex(t(i),y(i));
end;
V=[t',y']
plot(t,y)
title('satya')

How to Use the Program?

  1. You have to have the above program in a filename.m-file. I would call it euler.m.
  2. You also have to have a file ex.mand you type in your equation in the file. I typed in a problem as follows:
    %x is a function of t and y is the first derivative x'(t)
    function y=y(t,x)
    y=(t^2-x^2)*sin (x);

  3. Now, on matlab prompt, you write euler(n,t0,t1,y0) and return , where n is the number of t-values, t0 and t1 are the left and right end points and y(t0)=y0 is the innitial condition.
  4. Matlab will return your answer. You should also get the graph, if your computer is set up properly. I do not get the graph in my office but I get it in the lab.

Related Solutions

Solve the following equations using the Newton-Raphason method. ( using matlab) x^2+x*y^2 = 9 ?3x^2 *...
Solve the following equations using the Newton-Raphason method. ( using matlab) x^2+x*y^2 = 9 ?3x^2 * y - y^3 = 4    ?initial estimation of (x,y) = (1.2, 2.5) ?please help.. using matlab and matlab code
Solve using matlab code!! Use the graphical method to solve 4x1 − 8x2 = −24 x1...
Solve using matlab code!! Use the graphical method to solve 4x1 − 8x2 = −24 x1 + 6x2 = 34 Check your results by substituting them back into the equations.(include this on the code)
Solve the following given differential equations by using the following method: method of variations of parameters....
Solve the following given differential equations by using the following method: method of variations of parameters. 1. ?′′′ −?′′ −?′ +? = ?? 2. ?′′ − 2?′ + ? = ?? sin−1 ?
Write a MATLAB function function = pivGauss(.....) to solve linear equations using Gaussian Elimination with Partial...
Write a MATLAB function function = pivGauss(.....) to solve linear equations using Gaussian Elimination with Partial Pivoting. You'll need to employ Nested Loops. Thank you !
Question 1 Using MATLAB solve the following system of linear simultaneous equations 3x + 2y -...
Question 1 Using MATLAB solve the following system of linear simultaneous equations 3x + 2y - z = 10........... [1] -x + 3y + 2z = 5........... [2] x - y - z = -1 .................[3] s + 2t - 3u + 4v = 12........... [1] 2s + 2t - 2u + 3v = 10......... [2] t + u = -1............................ [3] s - t + u - 2v = -4................ [4]
1) Solve the system of linear equations, using the Gauss-Jordan elimination method. (If there is no...
1) Solve the system of linear equations, using the Gauss-Jordan elimination method. (If there is no solution, enter NO SOLUTION. If there are infinitely many solutions, express your answer in terms of the parameters t and/or s.) 3y + 2z = 1 2x − y − 3z = 4 2x + 2y − z = 5 (x, y, z) = 2) Solve the system of linear equations, using the Gauss-Jordan elimination method. (If there is no solution, enter NO SOLUTION....
Solve the following system of equations using the Substitution Method. 1.x + 3y = – 2...
Solve the following system of equations using the Substitution Method. 1.x + 3y = – 2 5x + 15y = 0 2. x – 4y = 10 3x – 2y = 10 3. 4a + 7b = 54 2a – 3b = 14 4. 2x – 3y = 1 8x – 12y = 4 5. 3x + 4y = 12 6x + 8y = 24 6.  2a – 5b = 10 3a – b = 2
Convert the follow system of equations to standard form and solve using Simplex method to find...
Convert the follow system of equations to standard form and solve using Simplex method to find optimal solution Maximize 10.75x + 5.3y constraints 0.25x + 0.6y < = 1000 0.50x + 0.1y <= 1000 0.25x + 0.3y <= 1000 x>=250, y>=250
Using Matlab 1. Solve the following equations set f1 (x1,x2) = sin (sin (x1)) +x2 f2...
Using Matlab 1. Solve the following equations set f1 (x1,x2) = sin (sin (x1)) +x2 f2 (x1,x2) = x1+ e^(x2) a) Can this equation set be solved by the fixed - point method with the following expressions? And why? Show your analysis with a 2D graph. g1 (x1,x2) = -e^(x2) g2 (x1,x2) = -sin⁡(x1) b) Use Newton Raphson Method with initial values x1 = -2, x2 = 1.5. (8 significant figures. Please submit the code and results.)
Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 2y + z...
Solve the system of linear equations using the Gauss-Jordan elimination method. 2x + 2y + z = 3 x + z = 2 4y − 3z = 13 solve for x,y,x
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT