Answer to Question #277800 in MatLAB for Rohit

Question #277800

Write a MATLAB program to solve the following two-point boundary

value problem for

d^2theta/dt^2 = -theta(t); 0 < t < 2theta; theta(0) = 0.7; theta(2pie) = 0.7:


1
Expert's answer
2021-12-09T17:37:14-0500
% y = [theta; d_theta/d_t]
bvpfcn = @(t, y) [y(2); -y(1)];               % right side function
bcfcn = @(ya, yb) [ya(1)-0.7; yb(1)-0.7];     % boundary conditions
guess = @(t) [1; 0];              % initial guess
xmesh = linspace(0, 2*pi, 10);
solinit = bvpinit(xmesh, guess);
sol = bvp4c(bvpfcn, bcfcn, solinit);
plot(sol.x, sol.y, '-o')
legend(["theta", "theta'"], "location", "southeast")

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