A Assignment 92.6 x Y se Euler\'s method to obtain C Use Euler\'s Method To Obta
ID: 3111620 • Letter: A
Question
A Assignment 92.6 x Y se Euler's method to obtain C Use Euler's Method To Obta C Use Euler's Method To Obtai Y Solve the given diffential C1) Solve The Given Different+ t/Assignment-Responses/submit?dep-17117777 080% Search se euler's method to obtain a four-decimal approximation C Q, online coupons |-Groceries Restaurants Weekly Ads ||HE Freebies | 95. G 3. 1/19 pointsI Previous Answers ZiIDiHEOModAp11 2.6004 Use Euler's method to obtain a four-decimal approximation of the indicated value. First use h -0.1 and then use h-0.05. Find an explicit solution for the initial-value problem and then fill in the following tables. (Round your answers to four decimal places. Percentages may be rounded to two decimal places.) My Notes Ask Your y-2 1) - y(1.5) -1 (explicit solution) h 0.1 Actual Absolute % Rel. 1.00 1.0000 0.0000 0.00 1.10 1.2337 1.20 1.5527 1.30 1.9937 1.40 2.6117 1.50 3.4903 ActuaAbsolute Value 9% Rel.Explanation / Answer
clc;
clear all;
f=@(x,y) 2*x*y;
h=0.1;
y0(1)=1;
x=1:h:1.5;
n=(1.5-1)/h
y(1)=y0(1);
%Euler formula
for i=1:n
y(i+1)=y(i)+h*f(x(i),y(i));
end
%Actual value
for i=1:n+1
y_ex(i)=exp(x(i)^2-1);
end
%Absolute Error
for i=1:n+1
er(i)=abs((y_ex(i)-y(i)));
end
%Relative Erorr Percentsge
for i=1:n+1
rel(i)=abs((y_ex(i)-y(i))/y_ex(i))*100;
end
disp('________________________________________________________________________________')
disp('x_n y_n Atcual_value abs_error rel_error_per')
disp('________________________________________________________________________________')
for i=1:n+1
fprintf('%f %f %f %10f %8.2f ',x(i),y(i), y_ex(i),er(i),rel(i))
end
________________________________________________________________________________
x_n y_n Atcual_value abs_error rel_error_per
________________________________________________________________________________
1.000000 1.000000 1.000000 0.000000 0.00
1.100000 1.200000 1.233678 0.033678 2.73
1.200000 1.464000 1.552707 0.088707 5.71
1.300000 1.815360 1.993716 0.178356 8.95
1.400000 2.287354 2.611696 0.324343 12.42
1.500000 2.927813 3.490343 0.562530 16.12
h=0.05
clc;
clear all;
f=@(x,y) 2*x*y;
h=0.05;
y0(1)=1;
x=1:h:1.5;
n=(1.5-1)/h
y(1)=y0(1);
%Euler formula
for i=1:n
y(i+1)=y(i)+h*f(x(i),y(i));
end
%Actual value
for i=1:n+1
y_ex(i)=exp(x(i)^2-1);
end
%Absolute Error
for i=1:n+1
er(i)=abs((y_ex(i)-y(i)));
end
%Relative Erorr Percentsge
for i=1:n+1
rel(i)=abs((y_ex(i)-y(i))/y_ex(i))*100;
end
disp('________________________________________________________________________________')
disp('x_n y_n Atcual_value abs_error rel_error_per')
disp('________________________________________________________________________________')
for i=1:n+1
fprintf('%f %f %f %10f %8.2f ',x(i),y(i), y_ex(i),er(i),rel(i))
end
n =
10
________________________________________________________________________________
x_n y_n Atcual_value abs_error rel_error_per
________________________________________________________________________________
1.000000 1.000000 1.000000 0.000000 0.00
1.050000 1.100000 1.107937 0.007937 0.72
1.100000 1.215500 1.233678 0.018178 1.47
1.150000 1.349205 1.380575 0.031370 2.27
1.200000 1.504364 1.552707 0.048344 3.11
1.250000 1.684887 1.755055 0.070167 4.00
1.300000 1.895498 1.993716 0.098217 4.93
1.350000 2.141913 2.276183 0.134270 5.90
1.400000 2.431071 2.611696 0.180625 6.92
1.450000 2.771421 3.011686 0.240265 7.98
1.500000 3.173277 3.490343 0.317066 9.08
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.