Develop a MATLAB program to solve problem 19 using a step si

Develop a MATLAB program to solve problem 1.9 using a step size of 0.5 d and 0.125 d. Compare both approximation comment about it.

This is problem 1.9 from Textbook Numerical methods for engineers 7th ed:

Solution

MATLAB script for the problem is as below:

%step size is defined as h=0.5

clear all;

h=0.5;
Q = 450;
A = 1250;

t=0;
y=0;
disp(\' t y\');
for i = 1:(10/h)
f(i) = (3*Q*sin(t(i))^2)/A-(Q/A);
y(i+1) = y(i)+h*f(i);
t(i+1)=t(i)+h;
disp([t(i+1),y(i+1)]);
end

For step size of 0.125, the value of h in the above script to be changed as h =0.125;

By changing the step size the approximation of y is chnaged, for example

at t = 0.5

for h =0.5, y = -0.1800 and for h = 0.125, y = -0.1515

at t = 1

for h =0.5, y = -0.2359 and for h = 0.125, y = -0.1120

Thus, it can be observed that the approximation with different step size results in different approximation. Smaller the step size, more accurate is the approximation.

at t = 10

for h =0.5, y = 1.4945 and for h = 0.125, y = 1.5348

Develop a MATLAB program to solve problem 1.9 using a step size of 0.5 d and 0.125 d. Compare both approximation comment about it. This is problem 1.9 from Text

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site