Answer to Question #149151 in MatLAB for rock

Question #149151
. Write a MATLAB program to solve the following BVPs
. Solve the following BVP
∇2u = 0, 0 ≤ r ≤ 1, 0 ≤ θ ≤ π
with boundary conditions
u(1, θ) = 4
Ï€
(πθ − θ
2
), u(r, 0) = u(r, π) = 0, u(0, θ) < ∞.
1
Expert's answer
2020-12-10T07:50:19-0500
% a.
% defining eqn
bvpfcn = @(t,Theta) [Theta(2) -Theta(1)];

% coding boundary condition
bcfcn = @(Ta,Tb) [Ta(1)-0.7  Tb(1)-0.7];

% defining guess function
guess = @(t) [sin(t) cos(t)];

% defing tmesh
tmesh = linspace(0,2*pi,20);
% defining solution
solinit = bvpinit(tmesh, guess);

% solve eqn
sol = bvp4c(bvpfcn, bcfcn, solinit);

% plot sulution
figure;
plot(sol.x, sol.y, '-o');
% label
xlabel("t");
ylabel("Theta");
title("a. t vs Theta");
legend("Theta","Theta'");

% b.
% defining eqn
bvpfcn = @(t,Theta) [Theta(2) -sin(Theta(1))];

% coding boundary condition
bcfcn = @(Ta,Tb) [Ta(1)-0.7  Tb(1)-0.7];

% defining guess function
guess = @(t) [sin(t) cos(t)];

% defing tmesh
tmesh = linspace(0,2*pi,20);
% defining solution
solinit = bvpinit(tmesh, guess);

% solve eqn
sol = bvp4c(bvpfcn, bcfcn, solinit);

% plot sulution
figure;
plot(sol.x, sol.y, '-o');
% label
xlabel("t");
ylabel("Theta");
title("b. t vs Theta");
legend("Theta","Theta'")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS