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
nexus9112 [7]
4 years ago
8

EXERCISE 5 Write a function file that creates the following piecewise function: f(x) =   ex−11 , x ≤ 5 −2x−1 , 5 < x ≤ 10 x

x−11 , 10 < x 6= 11 Assume x is a scalar. The function file should contain an if statement to distinguish between the different cases. Also, if the input is x = 11, the function should display "the function is undefined at x = 11". Test your function by evaluating f(4), f(5), f(5.5), f(10), f(11) and f(12)
Mathematics
1 answer:
steposvetlana [31]4 years ago
3 0

Answer:

Complete Matlab code with explanation and output results is given below

Explanation:

The given piece-wise function is

f(x) =  eˣ⁻¹¹   for x ≤ 5

           -2x - 1  for 5 < x ≤ 10  

          x/(x - 11) for x > 10 and x ≠ 11

A function f(x) is created using if else statements to select piece-wise functions with corresponding ranges. Also the last function is undefined at x = 11 therefore, it shows error whenever we enter x = 11.

Matlab Code:

function y=f(x)

if x==11

   fprintf("sorry! f(x) is not defined at x=11")

 else if x <= 5

       y = exp(x-11);          

   else if x > 5 & x <= 10

           y = (-2.*x) - 1;            

       else if x > 10

               y = x/(x - 11);

           end

       end

   end

end

end

Output:

f(4)

ans =  9.1188e-04

f(5)

ans =  0.0025

f(5.5)

ans =  -12

f(10)

ans =  -21

f(11)

sorry! f(x) is not defined at x=11

f(12)

ans = 12

output is tested for a wide range of inputs and the program is returning correct output values.

You might be interested in
Members of a baseball team raise $967.50 to go to a tournament. They rented a bus for $450.00 and budgeted $28.75 per player for
WINSTONCH [101]
967.50 = 450 + 28.75p
967.50 - 450 = 28.75p
517.5 = 28.75p
18 = p
7 0
3 years ago
Read 2 more answers
Which of the following is the solution set of the given equation?<br><br> (x - 3) - 2(x + 6) = -5
Vlad1618 [11]

Answer: x=−10

Step-by-step explanation:

x−3−2(x+6)=−5

x+−3+(−2)(x)+(−2)(6)=−5(Distribute)

x+−3+−2x+−12=−5

(x+−2x)+(−3+−12)=−5(Combine Like Terms)

−x+−15=−5

−x−15=−5

−x−15+15=−5+15

−x=10

8 0
4 years ago
Can anyone help me do the slope for this?
d1i1m1o1n [39]

Answer:

The value of the slope is 4

The meaning of the slope is y/x

Step-by-step explanation:

5 0
3 years ago
Solve the following System of Three Equations:<br> x−3y+z=−15<br> 2x+y−z=−2<br> x+y+2z=1
SashulF [63]

Answer:

x = -3 , y = 4 , z = 0

Step-by-step explanation:

Solve the following system:

{x - 3 y + z = -15

2 x + y - z = -2

x + y + 2 z = 1

Hint: | Choose an equation and a variable to solve for.

In the first equation, look to solve for z:

{x - 3 y + z = -15

2 x + y - z = -2

x + y + 2 z = 1

Hint: | Solve for z.

Subtract x - 3 y from both sides:

{z = 3 y + (-x - 15)

2 x + y - z = -2

x + y + 2 z = 1

Hint: | Perform a substitution.

Substitute z = -15 - x + 3 y into the second and third equations:

{z = -15 - x + 3 y

15 + 3 x - 2 y = -2

x + y + 2 (-15 - x + 3 y) = 1

Hint: | Expand the left hand side of the equation x + y + 2 (-15 - x + 3 y) = 1.

x + y + 2 (-15 - x + 3 y) = x + y + (-30 - 2 x + 6 y) = -30 - x + 7 y:

{z = -15 - x + 3 y

15 + 3 x - 2 y = -2

-30 - x + 7 y = 1

Hint: | Choose an equation and a variable to solve for.

In the second equation, look to solve for x:

{z = -15 - x + 3 y

15 + 3 x - 2 y = -2

-30 - x + 7 y = 1

Hint: | Isolate terms with x to the left hand side.

Subtract 15 - 2 y from both sides:

{z = -15 - x + 3 y

3 x = 2 y - 17

-30 - x + 7 y = 1

Hint: | Solve for x.

Divide both sides by 3:

{z = -15 - x + 3 y

x = (2 y)/3 - 17/3

-30 - x + 7 y = 1

Hint: | Perform a substitution.

Substitute x = (2 y)/3 - 17/3 into the third equation:

{z = -15 - x + 3 y

x = (2 y)/3 - 17/3

(19 y)/3 - 73/3 = 1

Hint: | Choose an equation and a variable to solve for.

In the third equation, look to solve for y:

{z = -15 - x + 3 y

x = (2 y)/3 - 17/3

(19 y)/3 - 73/3 = 1

Hint: | Isolate terms with y to the left hand side.

Add 73/3 to both sides:

{z = -15 - x + 3 y

x = (2 y)/3 - 17/3

(19 y)/3 = 76/3

Hint: | Solve for y.

Multiply both sides by 3/19:

{z = -15 - x + 3 y

x = (2 y)/3 - 17/3

y = 4

Hint: | Perform a back substitution.

Substitute y = 4 into the first and second equations:

{z = -x - 3

x = -3

y = 4

Hint: | Perform a back substitution.

Substitute x = -3 into the first equation:

{z = 0

x = -3

y = 4

Hint: | Sort results.

Collect results in alphabetical order:

Answer:  {x = -3 , y = 4 , z = 0

4 0
3 years ago
Find an explicit formula for the geometric sequence <br> 1/2,-4, 32,-256, ..<br><br> a(n) =?
Travka [436]
The explicit formula for this arithmetic sequence is A(n)=1/2•(-8)^(n-1)
7 0
3 years ago
Other questions:
  • gabe contributes 15% of the total cost of his individual health carecoverage. he pays $28.80 per week towards this contribution.
    7·1 answer
  • Which expression is equivalent to 3.5x+1.5x+2-1/2
    5·1 answer
  • What is -2m^2-2mn+8-10m+10n+mn+4n^2-5n simplify to
    13·1 answer
  • Martin earned the following scores on his last five tests.
    15·2 answers
  • HELP THIS IS WORTH 40 POINTS Lucy has a jewelry business. To make a certain necklace, she spends $3.38 on materials and $5.57 on
    11·2 answers
  • Find the values of x for which the combined function h(x) =f(x)/g(x) is undefined if f(x) = 5x + 1 and g(x) = x2 - 9.
    6·2 answers
  • Help ASAP Please check to see if I have the last part correct. Thanks
    13·2 answers
  • Can anyone know the answer please
    11·1 answer
  • Mmmmm help HELPPPPP,,,,,,
    9·1 answer
  • There are 4 aces and 4 kings in a standard deck of playing cards. you pick one random card at random. What is the probability of
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!