Thursday, October 31, 2019

ODE by Euler's Method Scilab code

ODE by Euler's Method Scilab code

Code is Here


clear
deff('z=f(x,y)','z=3*x+y/2');
printf("The given function is dy/dx=x+y\n");
X(1,1)=input('Enter the value of x0 : ')
Y(1,1)=input('Enter the value of y0 : ')
b=input('Enter the value of x : ')
n=input('Enter the value of n : ')
h=(b-X(1,1))/n
for i=2:n+1
    X(1,i)=X(1,i-1)+h
end
disp(X,"X=")
for j=2:n+1
    Y(1,j)=Y(1,j-1)+h*f(X(1,j-1),Y(1,j-1))
end
disp(Y,"y=")
printf("\nSo Value of y(%d) is = %f\n",n,Y(n+1))


ODE by Euler's Method Scilab code
ODE by Euler's Method Scilab code

No comments:

Post a Comment