Question

In Matlab please

da? Solve the boundary value problem: 0.1-0.057 subject to the conditions:y(0)=0 and y(10)=100. Find the maximum value of y o

0 0
Add a comment Improve this question Transcribed image text
Answer #1

dly du² 0.1 dy - 0.05 y dze Ylo)-0, y(10)=100 assurone, wa dy dhe dy में dw da d2y du? 11 0,1 dy - 0.05 an 0.1 W -0.05% Hence

clc
clear all

xf = 10; % final time
y0 = 0; % initial value of y
yf = 100; % final value of y

%% define defferential equation
%- assume dy/dx = w
dy_dx =@(x,y,w) w;
dw_dx =@(x,y,w) 0.1*w - 0.05*y;
y(1,1) = y0;
% initial guess for w(0)
w(1,1) = (yf - y0)/(xf -0);

% solutin for first guess using euler method
h = 0.001; % stepsize
x = 0:h:xf;
for i = 1:length(x)-1
w(1,i+1) = w(1,i) + h*dw_dx(x(i),y(1,i),w(1,i));
y(1,i+1) = y(1,i) + h*dy_dx(x(i),y(1,i),w(1,i));
end
% second guess of w
w(2,1) = 3*(yf - y0)/(xf -0);
y(2,1) = y0; % remains same

% solution for second guess using euler method
for i = 1:length(x)-1
w(2,i+1) = w(2,i) + h*dw_dx(x(i),y(2,i),w(2,i));
y(2,i+1) = y(2,i) + h*dy_dx(x(i),y(2,i),w(2,i));
end
%% Refinement of solution using interpolation and further solution using
% Euler method
% next guess of w using interpolation technique
w(3,1) = w(1,1) + (yf-y(1,end))*(w(2,1)-w(1,1))/(y(2,end)-y(1,end));
y(3,1) = y0;
% Final solution using euler method
for i = 1:length(x)-1
w(3,i+1) = w(3,i) + h*dw_dx(x(i),y(3,i),w(3,i));
y(3,i+1) = y(3,i) + h*dy_dx(x(i),y(3,i),w(3,i));
end
%% Maximum value of y
ymax = max(y(end,1:end));
fprintf('\nMaximum value of y = %0.2f\n',ymax)

Command Window Maximum value of y = 108.80 fx »|

note:

thankyou:)

Add a comment
Know the answer?
Add Answer to:
In Matlab please da? Solve the boundary value problem: 0.1-0.057 subject to the conditions:y(0)=0 and y(10)=100....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT