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
What is one pass of a coding sequence called?​
Romashka-Z-Leto [24]

One pass code is final version of executable file for end user with zero error. While compile the software it give Error it give the list of error to end user further to address the issue.

<u>Explanation:</u>

In computer pass of a code is used in compiler mode of programing languages. Normally end user after completing the software development he or she will compile the software programs.

So as result compiler will  pass code in multiple sequence and make the software as executable file as standalone or execute file which executable software can understanding language.

3 0
3 years ago
Read 2 more answers
Which of these words could byte pair encoding compress the most?
nlexa [21]

Answer:

My dad

Explanation:

7 0
4 years ago
Write a script named numberlines.py. This script creates a program listing from a source program. This script should: Prompt the
ddd [48]

Answer:

See explaination for program code.

Explanation:

inputFileName = input("Input filename: ") outputFileName = input("Output filename: ") inputFile = open(inputFileName, "r") outputFile = open(outputFileName, "w") count = 1 for line in inputFile: newLine = str(count).rjust(4, " ") + "> " + line outputFile.write(newLine) print(newLine) count += 1

4 0
3 years ago
What type of websites, which let users share personal stories and photos, became popular in the 2000s?.
Lina20 [59]

Answer:

MMORPGS was a type of website that let users share their stories and pics across the world wide web

Explanation:

8 0
3 years ago
Dynamics simulate stillness via calculations performed by the computer.
mash [69]

Answer:

<h3>True</h3>

Explanation:

<h3>The answer is true because...............................</h3>
3 0
3 years ago
Read 2 more answers
Other questions:
  • The intended purpose of the following module is to determine whether the value parameter is within a specified range. The module
    14·1 answer
  • Pat creates a table in a spread sheet
    9·1 answer
  • what's the best mouse for fast clicking ? I play a lot of fps and a lot of pvp games I need a mouse that I can click fast with a
    14·1 answer
  • Eric walks 7 km East in 2 hours and then 2.5 km West in 1 hour.
    13·1 answer
  • Siva added a Contact Form to her website. This is used for the collection to be included in
    5·1 answer
  • While performing maintenance work on the components of a computer, you feel a small electric shock. Before you began working, yo
    5·1 answer
  • in access, entering the search criteria "B?" would yield which of the following results? a. bentonville b. be c. brimingham d. b
    14·1 answer
  • What is a cell in computers
    7·2 answers
  • How would I add a play again function to this code in python?
    9·1 answer
  • a company recently implemented a secure sockets layer/transport layer security (ssl/tls) version that supports secure hashing al
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!