Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a MATLAB script using the input( ) and disp( ) functions to display the above equation (without any ans = etc.) and prompt
Write a MATLAB script using the input( ) and disp( ) functions to display the above equation (without any "ans = " etc.) and prompt the user for the value of a in meters and the value of b in meters. For example, for a = 5 and b = 4:
The surface area of an unusually shaped object, in m2, is given by: Area(a,b)=ab(a+2)(b3)4. Write a MATLAB script using the input( ) and disp( ) functions to display the above equation (without any "ans = " etc.) and prompt the user for the value of a in meters and the value of b in meters. For example, for a=5 and b=4 : Enter the value for a in meters: 5 Enter the value for b in meters: 4 Then using if-elseif, fprintf( ), and logical OR " " functions provide the area result in m2 as The area is xm2. where XX is the (floating point) result of the volume calculation, printed with one decimal point of precision. Check to verify the area is greater than zero. If not, return the message "Area must be greater than zero." and return no area result. If a or b is zero or negative, return the message "Input parameters must be greater than zero." and provide no area result. If either a or b is greater than 10 , return the message "Input values greater than 10m are possible but unlikely." and then on the next line provide the area result in the format shown. Area (a,b)=ab(a+2)(b3)4 Enter the value for a in meters: 12 Enter the value for b in meters: 0.3 Input values greater than 10m are possible but unlikely Area is 37.4 in m2. Area (a,b)=ab(a+2)(b3)4 Enter the value for a in meters: 0.1 Enter the value for b in meters: 12 Area must be greater than zero. Area (a,b)=ab(a+2)(b3)4 Enter the value for a in meters: 3 Enter the value for b in meters: 0.2 Area is 10.6 in m2. Area (a,b)=ab(a+2)(b3)4 Enter the value for a in meters: 8 Enter the value for b in meters: 0 Input parameters must be greater than zero
Step 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