Demo entry 6780666

MYTCP0

   

Submitted by anonymous on Dec 28, 2018 at 07:33
Language: Matlab. Code size: 318 Bytes.

function [x,y] = Euler(h)
%-------------------------------显式欧拉方法-------------------------------%
%给出步长h
%h = 0.001;
%点数N
N = round(1/h);
%边界条件
y0 = 0;
%解向量
x = (0:h:1)';
y = zeros(N+1,1);
%循环
y(1) = y0;
y(2) = y0;
for n = 3:N+1
    y(n) = y(n-1)+h*(atan(x(n-1)+y(n-1))*exp(-(x(n-1)^2+y(n-1)^2)));
end

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).