This is what I have so far. x0=0; y0=1; N=3; xstar=1.3; h=(xstar-x0)/N; x=(x0+h)
ID: 2988275 • Letter: T
Question
This is what I have so far.
x0=0; y0=1; N=3; xstar=1.3;
h=(xstar-x0)/N;
x=(x0+h):h:xstar;
y=zeros(1,N);
for i=1:1:N
if i==1
k(i) = ((x0 + 1)*y0)/x0;
elseif i>1
k(i) = (x + h/2 + 1)*(y + h/2*k(i));
end
% y(i) = y + h*k(i);
end
y(N)
Explanation / Answer
%Euler's Method clear all; n = .01 y = zeros(1,n); % Create a vector for the y values which will be calculated y(1) = 300000 t(1) = 0; %This loop computes one step of Euler's method each iteration % Use f_outline.m to help compute each value of y. while y(i)>0 for i = 2:n t(i) = i*n y(i) = f_outline(t(i),y(i)) end end plot(t,y)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.