Question

I matlab, write a script that obtains user input, and displays the answer to a question...

I matlab, write a script that obtains user input, and displays the answer to a question Write a program that uses the input function to ask a user for a depth of snow, and area of a rooftop. Let's assume that the density of snow is 100 kg/m3 (feel free to play around with this as another user input). Output to the screen a message telling the user the total weight of the snow (in kg) on their roof.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
area = input("Enter area of roof top(square mt): ");
depth = input("Enter depth of the snow(meters): ");

volume = area * depth;
weight = volume * 100;

fprintf("Total weight of the snow is %f kg\n", weight)
Add a comment
Know the answer?
Add Answer to:
I matlab, write a script that obtains user input, and displays the answer to a question...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a matlab script(using only matlab) for this. Write a script to solve the following problem:...

    Write a matlab script(using only matlab) for this. Write a script to solve the following problem: Ask the user for the length and the width of a rectangle. These need to be passed to a function. The function is to calculate and return the area and the perimeter of the rectangle. The area is the length times the width and the perimeter is 2 times the length and 2 times the width. Make sure to suppress all output from the...

  • In Matlab, write a script which asks a user to input numbers until the user inputs...

    In Matlab, write a script which asks a user to input numbers until the user inputs 0. Then the script should print only the positive numbers entered by the user, in reverse order. For example, if the user inputs “4,-1,5,2,-3,-8,0” the script should print “2,5,4”.

  • this is for script for terminal or putty question 1------ 1. Write a PERL script/program based...

    this is for script for terminal or putty question 1------ 1. Write a PERL script/program based on the following requirements. The program should to prompt the user for how many courses the plan to take next semester and ask the user to enter each of those courses before displaying all the information entered back on the screen. question 2------ 2. Write a PERL script that defines/declares an array or a list of elements. The array should hold three-letter abbreviations for...

  • 1) Write a MATLAB script to prompt a user to input two numbers, then assess whether...

    1) Write a MATLAB script to prompt a user to input two numbers, then assess whether the two numbers are equal or not. If the two numbers are equal, display that they are equal in the Command Window. If they are not equal, display that they are not equal in the Command Window. 2) Write a MATLAB script that prompts the user to enter the day of the week using the input function. If the information the user enters is...

  • Write a MATLAB script, which asks the user to input the angle xd (in deg) and...

    Write a MATLAB script, which asks the user to input the angle xd (in deg) and then approximates sine of the angle using the first 5 terms of Taylor series as follows: n+12n-1 sin n-1 (2n-1)! 1 Note that x in Taylor's equation is in radian, so make sure to do the conversion first Start with defining the vector n=1:5 and then use element-wise operation and basic MATLAB commands to calculate the summation. To calculate the factorial of any number,...

  • USING MATLAB Write a script that asks the user to input a sentence. It then replaces...

    USING MATLAB Write a script that asks the user to input a sentence. It then replaces all instance of 'he', 'she', 'He', or 'She' with 'Mr. Meseeks' and prints out the new sentence. . HINT: Use 'strrep' and 'lower' function.

  • Write a script in matlab that prompts the user to input the day, month, and year;...

    Write a script in matlab that prompts the user to input the day, month, and year; determine the day of the year (the number of days including the current day). Be sure to take leap year into account. Use a for loop Test your code on the following dates: February 28, 2015 April 9, 1976 October 12, 1887 Create a script that performs the same function as repmat. The only built-in commands you may use are input, size, and disp.

  • Modular program mathlab: Write a program in Matlab that would continuously ask the user for an...

    Modular program mathlab: Write a program in Matlab that would continuously ask the user for an input between 1 and 6, which would represent the result of rolling a die. The program would then generate a random integer between 1 and 6 and compare its value to the value entered by user. If the user’s die is larger, it should display, “You got it” If the user’s die is smaller, it should display, “Nice try” If the results are the...

  • BME 2013 Spring 2019 Exam 3 Matlab Review Sheet 1. Given the vector of patient body temperatures ...

    can anyone help me figure out how fo write matlab code for these problems? BME 2013 Spring 2019 Exam 3 Matlab Review Sheet 1. Given the vector of patient body temperatures T (98.6, 102, 101, 99,98.9, 102.1, 100.3, 101.2, 98.4 97.6, 100] use conditional statements and loops to write a program that determines and displays (using the fprintf function) the number of patients with a fever and patients without a fever. The program must ask the user to input the...

  • read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates th...

    read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates the BMI using the equation below, displays the BMI category, and outputs the BMI value tothe user's program W (kg) h2 (m2) BMI Display Normal if 18.5 s BMI 25 Display Overweight if 25 s BMI <30 Display Obese if BMI 2 30 Else display underweight So you will create two...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT