Problem # 3 WRITE A MATLAB CODE TO SOLVE THE FOLLOWING PROBLEM P-3 Flow between
ID: 3869032 • Letter: P
Question
Problem # 3
WRITE A MATLAB CODE TO SOLVE THE FOLLOWING PROBLEM
P-3 Flow between two parallel plates is described by the following equation:
Calculate the velocity profile using the shooting method for solving the given BVP and compare your results by plotting the numerical solution over the plot of the analytical solution described by:
Hint: use 1.75 for the first initial slope, and the other one is 0.45 to 0.5.
op with boundary conditions given as u-,-0 & uh with boundary conditions given as u-h-0 & u,-0Explanation / Answer
The below programs will satisfy the given requirements as follows:-
Here we used ode45 function in matlab which integrates the system of differential equations y'=f(t,y).
syntax :- [t,y] = ode45(odefunction,tspan,y0), where tspan = [t0 tf],
The odefunction in the aboove is specified as a function handle which defines the functions to be integrated. It can be coded as follows:-
odefunction:-
------------------
function dudy = odefunction(y,u)
u1 = u(1);
u2 = u(2);
mue = 0.75;
dopdox = -0.000025;
h=30;
du1dy = u2;
du2dy = 1/mue*dopdox;
dudy = [du1dy; du2dy];
For First initial slope:-
--------------------------
u10 = 0;
u20 = 1.75;
init = [u10 u20];
dspan = [theata d];
[y,u] = ode45(@odefunction,dspan,init);
plot(y,u(:,1.75),[d],[theata],'ro')
xlabel('Distance (lu)')
ylabel('Velocity (lu/ts)')
For final solution:-
-----------------------
init = [u10 u20];
dspan = [theata d];
[y,U] = ode45(@odefunction,dspan,init);
figure
plot(y,U(:,1),d,theata,'ro')
xlabel('Distance (lu)')
ylabel('Velocity (lu/ts)')
For plotting the numerical solution over the plot of the analytical solution :-
-------------------------------------------------------------------------------------------------
mue = 0.75;
dopdox = -0.000025;
h=30;
u = (1/(2*mue))*(dopdox)*(y^2-h^2)
hold all
plot(y,u,'r--')
legend 'analytical solution'
xlabel('Distance (lu)')
ylabel('Velocity (lu/ts)')
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.