Question: Use of the FOR LOOP Rewrite the code below through the use by adopting the FOR LOOP: %discretization h=0.1; t=0:h:2.5; %Euler's method y(1)=3 %(y(i+1)-y(i))/h=-1.2*y(i)+7*exp(-0.3*t(i)) i=1
Use of the FOR LOOP Rewrite the code below through the use by adopting the FOR LOOP: %discretization h=0.1; t=0:h:2.5; %Euler's method y(1)=3 %(y(i+1)-y(i))/h=-1.2*y(i)+7*exp(-0.3*t(i)) i=1 y(i+1)=(-1.2*y(i)+7*exp(-0.3*t(i)))*h+y(i) 1=2 y(i+1)=(-1.2*y(i)+7*exp(-0.3*t(i)))*h+y(i) i=3 y(i+1)=(-1.2*y(i)+7*exp(-0.3*t(i)))*h+y(i) i=4 y(i+1)=(-1.2*y(i)+7*exp(-0.3*t(i)))*h+y(i) and so on in order to arrive at the end of the array t
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
