Script Name: prob3 Script Variables: paint_area (double) - surface area to be co
ID: 3636650 • Letter: S
Question
Script Name: prob3 Script Variables: paint_area (double) - surface area to be covered by paint (sq. ft) paint_gallons (double) - number of gallons of paint needed Problem Statement: Write a script named "prob3" that will calculate the surface area that is to be painted on a house and how many gallons of paint will be needed. The house is a rectangular prism that measures 30 ft wide, 50 ft long, and 10 ft tall. The roof and the floor will not be paintcd.% Each side has 2 windows that are 2 ft by 3 ft that will not be painted. Store the amount of surface area to be covered in "paint_aroa". Use this value to calculate how much paint will be needed to give the house one coat of paint. Each gallon of paint will cover 350 sq. ftExplanation / Answer
function sol = prob3 % This problem is epidemic model due to Cooke, more information can be % found in 'Time lags in Biological Models', by N. MacDonald. (This is % reference 8 of the tutorial). % Copyright 2004, The MathWorks, Inc. % Problem parameters, visible in nested functions. b = 2; c = 1; e = 1 - c/b; % Equilibrium point. sol = dde23(@prob3f,7,0.8,[0, 60]); figure plot(sol.x,sol.y,[0, 60],[e, e],'r') legend('y(t)','1 - c/b') title(['Problem 3. Cooke Epidemic Model with' ... ' b = ',num2str(b),' , c = ',num2str(c),'.']) xlabel('time t') %----------------------------------------------------------------------- % Nested function % function yp = prob3f(t,y,Z) %PROB3F The derivative function for Problem 3 of the DDE Tutorial. yp = b * Z * (1 - y) - c * y; end % prob3f %----------------------------------------------------------------------- end % prob3
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.