Position: Home page » Computing » Detailed explanation of Runge Kutta's calculation force

Detailed explanation of Runge Kutta's calculation force

Publish: 2021-04-27 23:44:59
1.

(1) Periodic deviations in the situation are:
Cyclong-Kutta Act has a high degree of height, earning 25947; stability (in certain conditions) can be improved in calculation process, without need to calculate high-level levels, but still needs to be calculated at a number of points, such as the four-cyclog-Kutta Act requires four calculations per time. This makes a certain complexity for the real calculation, and therefore more used to calculate the table.
II, subprocess
#include < stdio.h > < br/>#include < math.h > < br/>#define f(x,y) (-1*(x)*(y)*(y)))
void main(void)
{
double a,b,x0,y0,k1,k2,k3,k4,h;
br/>int n,i;< br/>printf(input a,b,x0,y0,n:);< br/>scanf(%lf%lf%lf%lf%d, & a, & b, & x0, & y0, & n);< br/>printf(x0 k1 k2 k3 k4 );< br/>for(h=(b-a)/n,i=0; i!= n; i++)
{
k1=f(x0.y0);< br/>k2=f(x0+h/2.y0+k1*h/2);< br/>k3=f(x0+h/2.y0+k2*h/2);< br/>k4=f(x0+h.y0+h*k3);<0+h br/>printf(%lf %lf ,x0.y0);< br/>printf(%lf %lf ,k1,k2);< br/>printf(%lf %lf ,k3,k4);< br/>y0+=h*(k1+2*k2+2*k3+k4)/6; < br/>x0+=h;<
}
printf(xn=%lf yn=%lf .x0.y0);< br/>}
Operation Results:
input a,b,x0.y0, n:0 0 5 0 0 0 0 0 2 20 20 20 20 20 20 20 20 20 20 by br/br/ >...........................................................................................................................................................................599896 -1.279834 -1.295851 -1.292250
-1.222728
0.750000 1.279948 -1.228700 -1.110102 -1.139515
-0.990162
-1.000000 1.0027 -1.00000054 -0.5837 /-0.8995555837
-0.25005555556 - 0.7661515852 / / >1.250065555556-0.25005555556-0.76661552852 / / >1.2500652852/br / / >1.250065555555555555555556 1.750000 0.492374 -0.424257 -0.361915 -0.374868
-0.317855
-2.000000 0.400054 -0.320087 -0.275466 -0.284067
-0.243598
2.250000 0.329940 -0.244935 -0.212786 -0..21218538
-0.18994444482/br/br/ >-0.189444482
-0.2121858585383838 /...-0.21212185853838 /.......-0.212185858585383838 /..-0.18944br /..........-0.16666841414141-0.16668414141 -0.17000074444 min0.166668414141 -0.17020 -0.120024 -0.106973 -0.108868
-0.097048
3.250000 0.172989 -0.097256 -0.087300 -0.088657
-0.079618
3.500000 0.150956 -0.079757 -0.072054 -0.00773042minmin - 0.0007304242
-0.0055305
-0.0055305
-0.039833
-0.039833
4.500000 0.094123-0.039866 -0.036750 -0.037072
-0.034202
4.750000.084885-0.034226 -0.031675 -0.031926
-0.029571
n=5.000000 yn=0.076927

2. Unknown_Error
3. http://ke..com/link?url=dTC8pz6PJXWpZdsua4rFN_ panquCZBoHgwqPNwdvVqgZL_ aAEXaCy7vebNX-Sk_- rPmjGGne0mNuaYTurUhqP90-_ Qfkxnpwaxfkcyut
there is a derivation

it points out a misunderstanding of the building owner. Runge Kutta method is only a numerical solution, which can not be said to solve the equations. The numerical solution is only an approximate description of the analytical solution
4. Second stage resolution, initial conditions also need to be given to y1/39;( 0) and y2 '( 0). Processing at the present time as 0.

function zd530003514
a=0.1; < br/>b=0.1;< br/>Y0 = [b-1; 0; 0 b; < br/>
%mole
[t,Y]= ode45(@ode,[0 10]; Y0);< br/>y1=Y(:.1);< br/>y2=Y(:.3);< br/>
%map
subplot 211
plot(t,y1);< br/>subplot 212
plot(t,y2);< br/>
%microwave definition
function dY = ode(t, Y)
L1=5;< br/>L2=0.01;< br/>a0=2;< br/>b0=2;< br/>c0=2;< br/>
y1=Y(1); y2=Y(3);< br/>dY = [
< Y(2);< br/> -(a0*y2+b0*y2^2+c0*y2^3) - L1^2*L2*y1 - L1^2*y1; < br/> < Y(4);< br/> -(a0*y2+b0*y2^2+c0*y2^3) - L1^2*L2*y1; < br/>;
5. function [Y] = RK45(t,X,f,h)
K1=f(t,X);< br/>K2=f(t+h/2.X+h/2*K1);< br/>K3=f(t+h/2.X+h/2*K2);< br/>K4=f(t+h,X+h*K3);< br/>Y=X+h/6*(K1+2*K2+2*K3+K4);< br/>end
The code of the 4-cycle GUTA Act:
self-write communications, consisting of f.m
function dxdt = f (t,x)
dxdt(1)=exp(x(1)*sin(t)+x(2);< br/>dxdt(2)=exp(x(2)*cos(t)+x(1); % x(1) is your f, x(2) is your g
dxdt=dxdt(:);
End


itself gives t0.x0.h (initial time, initial value, steplength)
if the orbit requires 20 to t1: for example

t0=0; t1 is 5. h=0.02; x 0 is equal to negative 1. < br/>T=t0:h:t1; X=zero(length(x0),length(T)); X(:.1)=x0; < br/> for j=1:length(T)-1
> X(:,j+1)=RK45(T(j),X(:,j), @(t,x) f(t,x),h);end
plot(T,X(1,:);< < br/>plot(T,X(2,:),' r'); < br/>specific parameters themselves
6. Assuming the initial solution of problems:
y'= y-2x/y
(0< x < 1)
y/br/>y(0)(0)=1
y(0)=1
y(0)=1
y(0)=1
y(0)=1
private
private
private
sub
form_click()
/>minmin //>

singlesingle,
single, <
y2





single,


y4










=
0.2
i
=
0
to
1
step
0.2
k1
=
f(x, <
=
f(x,
y1)
y2
=
y
+
h




<
2
*
k3
+
k4)
print
" < < < < br // >y





private
private
function




singlesingle single,

bb b
bb b
atat
atat at
<
-
2
*
a
/
b
end
function
7. The problem can be solved and an analytical solution can be obtained. Dy / DX = a (Y-X) + 1D (Y-X) / DX = a (Y-X) i.e. D (Y-X) / (Y-X) = ADX integral: Y-X = CE ^ {ax} i.e. y = CE ^ {ax} + X is brought into the initial value condition, C = 1, so the special solution is y = e ^ {ax} + X
8. As long as you understand Runge Kutta, it's easy
define function,
F = func (x, y)
if y (1) & gt; 126,
f=[f1(y(1),y(2)), f2(y(1),y(2))];< br />else
f=[g1(y(1),y(2)), g2(y(1),y(2))];
end

then it's easy
9. Unknown_Error
10. Reference answer Don't promise when you are happy, don't answer when you are sad, don't make decisions when you are angry.
Hot content
Inn digger Publish: 2021-05-29 20:04:36 Views: 341
Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750