Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using matlab write the code for all these questions. 2. Using estimates of rainfall, evaporation, and water consumption, the town engineer developed the following model
Using matlab write the code for all these questions.
2. Using estimates of rainfall, evaporation, and water consumption, the town engineer developed the following model of the water volume in the reservoir as a function of time where V is the water volume in liters, t is time in days, and r is the town's consumption rate in liters per day. Write two user-defined functions. The first function should compute the volume of water for a given r and The second function should compute how long it will take for the water volume to decrease to x percent of its initial value of 109 L. The inputs to the second function should be x and r. Test your functions for the case where x = 50 percent and r-107 L/day 3. Write a program that accepts a year and determines whether the year is a leap year. Use the mod function. The output should be variable extra day, which should be lif the year is a leap year and 0 otherwise. The rules for the leap years in the Gregorian calendar are as follows: -All years even divisible by 400 are leap years. Years evenly divisible by 100 but not by 400 are not leap years. -Years divisible by 4 but not by 100 are leap years. All other years are not leap years 4. a. Write a script to display stars in the following order 289 b. Use a for loop to determine the sum of the first 20 terms in the series 3k2+2k. 5. Write a script that will: Generate a random integer in the inclusive range from 10 to 15 Loop that many times to -prompt the user for a number -print the sum of the numbers entered so far with one decimal placeStep 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