Question
Need Help in reviewing my code for the following problem statement. Consider a horizontal circular cylinder with diameter 0.31m and length 1.68m lying in a
Need Help in reviewing my code for the following problem statement. Consider a horizontal circular cylinder with diameter 0.31m and length 1.68m lying in a bathtub. The cylinder has a density of 989 kg/m3 and the water in the bathtub has a density of 1000 kg/m3. The acceleration due to gravity is 9.81 m/s2. Calculate the height of the cylinder above the water using the Bisection and False Position methods, with a range of 0 I have posted the code snippets in order. kindly help me review my code and if u can explain what im doing wrong that'd be great thank you. Kindly explain what's wrong with the code if you can or explain your own code
\% Constants d=0.33;% diameter of the cylinder [m] I=1.65;% length of the cylinder [m] P_body =983;% density of the body [kg/m3] P_water =1000;% density of the water [kg/m3] g=9.81;% acceleration due to gravity [m/s2] \% Function to calculate the volume of the cylinder that is submerged in water V=(h)pi/4d2(1(1h)); \% Function to calculate the force of buoyancy acting on the cylinder F_buoy =(h) P_water gV(h); \% Function to calculate the weight of the cylinder W=@(h) P_body gV(h); \% Function to calculate the net force acting on the cylinder F_net =@(h) F_buoy (h)W(h); \% Function to solve for the height h using False position method Falseposition =@(h,F_net, tol, N_max) a=0; b=0.5; c=0; N=; while NStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started