Use MATLAB to create a script which solves for problem 5.9 inthe book (5.11 in the 4th edition). Given are the equations for themoment, as a function of x, starting from the leftmost side of thebeam with x=0 and ending at the other end of the beam with x=12.This piecewise function together makes up the moment equation forthe beam given. 0 ≤ ? ≤ 3 ?(?) = 265? − 5.56?3 , 3 ≤ 6 ?(?) = −50?2 + 415? − 150, 6 < ? ≤ 10 ?(?) =−185? + 1650, 10 < ? ≤ 12 ?(?) = 100? − 1200 Use if-elsestatements to determine the f(x) value for each value of x (lowerbound, upper bound, and the guess for the root) to use in thebisection method. Also, use a while loop to iterate until theapproximate relative error is below the stopping criterion,es=0.05%. Finally, plot piecewise function and verify that the rootfound is at or near the point on the beam in which the moment iszero. Create appropriate labels (xaxis, y-axis, and title). Here'swhat should happen when the script is run:
>> Lab3Roots
>> xr =
8.918907165527344
PLEASE SHOW HOW TO TYPE THE SCRIPT! THANKS!