Question

In: Advanced Math

Write The MATLAB SCRIPT for: An open-top box is constructed from a rectangular piece of sheet...

Write The MATLAB SCRIPT for:

An open-top box is constructed from a rectangular piece of sheet metal measuring 10 by 16 inches. Square of what size (accurate to 10-9 inch) should be cut from the corners if the volume of the box is to be 100 cubic inches?
Notes: to roughly estimate the locations of the roots of the equation and then approximate the roots to this equation using Newton Iteration method.

Please don't give me the Matlab Commands for this. I need "Matlab Script" as its solution.

Solutions

Expert Solution



%%Matlab code for finding root using Newton method
clear all
close all


%Function for which root have to find
fun=@(x) x.*(10-2.*x).*(16-2.*x)-100;

%plotting of the function
xx=linspace(0,4,1001);
yy=fun(xx);
plot(xx,yy)
xlabel('x')
ylabel('y')
title('f(x) vs x plot')

%displaying the function
fprintf('For the function\n')
disp(fun)

[root]=newton_method(fun,0,1000);

fprintf('Value of x =%f.\n',root)

%Matlab function for Newton Method
function [root]=newton_method(fun,x0,maxit)
syms x
g1(x) =diff(fun,x);   %1st Derivative of this function
xx=x0;            %initial guess]
%Loop for all intial guesses
    n=eps; %error limit for close itteration
    for i=1:maxit
        x2=double(xx-(fun(xx)./g1(xx))); %Newton Raphson Formula
        cc=abs(fun(x2));                 %Error
        err(i)=cc;
        xx=x2;
        if cc<=n
            break
        end
      
    end
    root=xx;
end

%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%


Related Solutions

A box with an open top is to be constructed out of a rectangular piece of...
A box with an open top is to be constructed out of a rectangular piece of cardboard with dimensions length=10 ft and width=11 ft by cutting a square piece out of each corner and turning the sides up. Determine the length x of each side of the square that should be cut which would maximize the volume of the box.
A box with an open top is to be constructed out of a rectangular piece of cardboard with dimensions length=9 ft
A box with an open top is to be constructed out of a rectangular piece of cardboard with dimensions length=9 ft and width=6 ft by cutting a square piece out of each corner and turning the sides up as shown in the picture. Determine the length x of each side of the square that should be cut which would maximize the volume of the box. 
An open-top rectangular box is to be constructed with 300 in2 of material. If the bottom...
An open-top rectangular box is to be constructed with 300 in2 of material. If the bottom of the box forms a square, what is the largest possible box, in terms of volume, that can be constructed?
An open-top rectangular box is being constructed to hold a volume of 400 in3. The base...
An open-top rectangular box is being constructed to hold a volume of 400 in3. The base of the box is made from a material costing 7 cents/in2. The front of the box must be decorated, and will cost 10 cents/in2. The remainder of the sides will cost 2 cents/in2. Find the dimensions that will minimize the cost of constructing this box. Front width: Depth: Height:
An open-top box is to be made from a 20cm by 30cm piece of cardboard by...
An open-top box is to be made from a 20cm by 30cm piece of cardboard by removing a square from each corner of the box and folding up the flaps on each side. What size square should be cut out of each corner to get a box with the maximum volume?
An open rectangular box is made from a 9 inch by 12 inch piece of cardboard...
An open rectangular box is made from a 9 inch by 12 inch piece of cardboard by cutting squares of side length ? from the corners. Determine the length of the sides of the square which will maximize the volume. (Clearly identify the function in terms of one variable and state the domain, then solve.)
Suppose a tin box is to be constructed with a square base, an open top and...
Suppose a tin box is to be constructed with a square base, an open top and a volume of 32 cubic inches. The cost of the tin to construct the box is $0.15 per square inch for the sides and $0.30 per square inch for the base. The minimized cost of the tin box is: A. $3.50 B. $$4.82 C. none of the answers D. $9.07 E. $$\$0$$
An open-top rectangular box has a volume of 250 cm 3. The width of the box...
An open-top rectangular box has a volume of 250 cm 3. The width of the box is 5 cm. The cost is $2/ cm 2 for the base and $1/ cm 2 for the other sides. What is the minimum cost for making the box?
A box with an open top is to being created with a square piece of cardboard...
A box with an open top is to being created with a square piece of cardboard 8 inches wide, by cutting four identical squares in each corner. The sides are being folded as well. Find the dimensions of the box that has the largest volume.
A rectangular box with a square base and an open top and a volume of 1ft^3...
A rectangular box with a square base and an open top and a volume of 1ft^3 is to be made. Suppose the material used to build the sides cost $4 per ft^2 and the material used to build the bottom costs $1 per ft^2. Determine the dimensions (i.e. the side-length of the base and the height) of the box that will minimize the cost to build the box. Note: if we let x denote the side-length of the base and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT