1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aleksley [76]
3 years ago
12

Piecewise functions are sometimes useful when the relationship between a dependent and an independent variable cannot be adequat

ely represented by a single equation. For example, the velocity of a rocket might be described by where v is the rocket velocity in m/s and t is the time in seconds. Write a program to compute v as a function of t. Generate a plot of v versus t for t = −5 s to 70 s using 100 points for t. Requirement:
Computers and Technology
1 answer:
Andru [333]3 years ago
8 0

Answer:

//Set a piecewise function v(t).

function v = vpiece(t)

//Set the condition first for t.

if ((0<=t)and(t<=8))  //Set if condition

// first equation of velocity.

   v = 10*t^2 - 5*t;

//Set the condition second for t.

elseif((8<=t)and(t<=16))  //Set elseif condition

//second equation of velocity.

v = 624 - 5*t;

//set the condition third for t.

elseif((16<=t)and (t<=26))  //Set elseif condition  

//third equation of velocity.

v = 36*t + 12*(t - 16)^2;

//Set the fourth condition for t.

elseif t>26

//fourth equation of velocity.

v = 2136*exp(-0.1*(t-26));

//Last condition.

else

//fifth equation of velocity.

v = 0;

//End of the function v.

end

//set a variable and initialize it to 0.

a=0;

//Starting the loop.

for j = -5: 0.5 : 70

//Increment the value of a by 1.

a = a + 1;

t(a) = j;

v(a) = vpiece(t(a));

//End of for loop.

end

//Plot the graph between t and v.

plot(t,v)

//Write the label for the x-axis.

xlabel('t')

//Write the label for the y-axis.

ylabel('velocity')

//Write the title of the plot.

title('Plot of velocity vs t')

Explanation:

Firstly, we set the piecewise method.

Then we set the first condition, after that we apply the condition of velocity.

Then we set the second condition, after that we apply the condition of velocity.

Then we set the third condition, after that we apply the condition of velocity.

Then we set the fourth condition, after that we apply the condition of velocity.

Then we set the last or fifth condition, after that we apply the condition of velocity.

Then we set the variable "a" to 0.

Then start the loop and increase the value by 1.

And after all, we write the title of the plot.

You might be interested in
Which file extension indicates a Microsoft Excel document?
VikaD [51]
XLSX is the extension for an excel document.

3 0
3 years ago
Which 3 navigation features are missing in a reports only user view?
san4es73 [151]

Explanation:

when a user changes his or her view to a Report only view when using QuickBooks online they only see a report list page, without having such features as; Navigation panel, Search box or Quick Create (+) icon.

7 0
2 years ago
Read 2 more answers
What was the first computer to defeat a world champion chess player?
deff fn [24]
deep blue IBM's chess-playing computer
6 0
3 years ago
Can we declare top level classes as private or protected?
uysha [10]

Answer and Explanation:

top level class can not be declare as private or protected. It is always public. If we declare a top level class as private then the compiler always complain that the  private is not allowed  and if we declare top level class as protected then compiler complain that modifier protection is not allowed here. so we can not declare top level class as private or protected

5 0
3 years ago
A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost
makvit [3.9K]

Answer:

milk_produced = float(input("Enter the total amount of milk produced in the morning: "))

liter_cost = float(input("Enter the cost of producing one liter of milk: "))

carton_profit = float(input("Enter the profit on each carton of milk: "))

carton_needed = round(milk_produced / 3.78)

cost = milk_produced * liter_cost

profit = carton_profit * carton_needed

print("The number of milk cartons needed to hold milk is " + str(carton_needed))

print("The cost of producing milk is " + str(cost))

print("The profit for producing milk is " + str(profit))

Explanation:

*The code is in Python.

Ask the user to enter milk_produced, liter_cost and carton_profit

Calculate the number of milk cartons needed, divide the milk_produced by the capacity (3.78) of a cartoon and round the result

Calculate the cost, multiply the milk_produced by liter_cost

Calculate the profit, multiply the carton_profit by carton_needed

Print the results

3 0
3 years ago
Other questions:
  • Which destination ip address is used when an ipv6 host sends a dhcpv6 solicit message to locate a dhcpv6 server?
    15·1 answer
  • What is the most widely used operating system for mobile devices?
    7·1 answer
  • With network management software, a network manager can ____.
    6·1 answer
  • What character separates the file extension and the filename?
    13·2 answers
  • A bank uses a computer program during the night to tell if the alarm should ring. Sensors in the bank set the following Boolean
    5·1 answer
  • You are the CISO of a company and you need to create logging policies. Please review NIST SP800-92, specifically sections 4–3 th
    12·1 answer
  • software that provides capabilities common across all organizations and industries is known as ________ software.
    15·2 answers
  • What is the output after running the following code snippet? int number = 600; if (number &lt; 200) { System.out.println("Low sp
    15·1 answer
  • A virtual meeting is the same thing as a/an A. online meeting. B. VoIP. C. seminar. D. convention.
    12·1 answer
  • What are the advantages of mine shaft gear and the disadvantaged​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!