Question

In this exercise, you will create a function trough_plot which will plot the cross-section of a...

In this exercise, you will create a function trough_plot which will plot the cross-section of a trough outlines by the functions y0 and y.

Input variables:

x a vector representing the x co-ordinates for the outline of the trough.
y a vector representing the y co-ordinates for the bottom of the trough.
y0 a vector representing the y co-ordinates for the top of the trough.

Output variable: n/a – this function has no output variables.

Process:

The plots for y and y0 must be in the same figure, with the order below being strictly adhered to.

Graph the bottom of the trough (y)

The curve should be displayed using a red dashed line with a line width of 2.

On the same set of axes as the first curve, graph the top of the trough (y1).

The curve should be displayed using a yellow dashed line with a line width of 4.

Notes:

Although the trough_plot function does not have any output variables, the graph will be examined to determine if the correct values have been plotted.

There are plenty of resources to help you use the plot function, including the week 1 workshop and the link: plot

Do not use the figure command in your solution -- this will confuse AMS, which needs to manage the plotting environment to examine your results.

Potentially Useful Functions: plot, hold.

Function Template:

function trough_plot(x,y,y0) % INSERT_CODE_HERE end

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
In this exercise, you will create a function trough_plot which will plot the cross-section of a...
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
  • In this exercise, your will be creating the function euler2 which applies Euler's method to numerically...

    In this exercise, your will be creating the function euler2 which applies Euler's method to numerically solve a first order ODE, but with no overshoot. Input variables: ODEFUN – A function representing the the equation for y'. It must be a function of t and y. TSPAN – a vector containing the start time and end time (TSPAN = [tStart,tEnd]). Y0 – The value for y at tStart. h – The step size. Output variables: TOUT – The output time...

  • Given y1, y2, and y3 as a function of x. In the same graph plot the...

    Given y1, y2, and y3 as a function of x. In the same graph plot the three functions for x ?[-3,3] . Follow the form given below. function y1 Line style: solid, color: blue function y2 Line style: dashed, color: black function y3 Line style: dotted, color: red Label the x and y axis; x axis as (x), and the y axis as (y1,y2,y3), title the graph as (problem5), add a legend on the plot. y1=x^4-e^(-x) y2=x^2-x^3+25 y3=30-12x,

  • Suppose there are two non-empty list variables of equal length in Python called coords and sides. The variable coords contains sub-lists of size 2, with each of these values representing an x and a y...

    Suppose there are two non-empty list variables of equal length in Python called coords and sides. The variable coords contains sub-lists of size 2, with each of these values representing an x and a y co-ordinate. The variable sides also contains sub-lists of size 2, with each of these values representing firstly the length thern the width of a rectangle. Also assume there is also a function in Python called draw_rectangle which takes as its parameters two integers representing firstly...

  • this assignment should be in C++ In this assignment, you will implement two classes. Point: A...

    this assignment should be in C++ In this assignment, you will implement two classes. Point: A Point in a two dimensional plane has an integer x coordinate value and an integer y coordinate value. Rectangle: A Rectangle is a class that has three attributes: 1) Point type data that represent the top-left point of the rectangle, 2) integer length and 3) integer width. Write the appropriate class definition for Point class and Rectangle class with necessary constructors, mutator and accessor...

  • Use C Create a function that will take in a vector (three double variables) representing a...

    Use C Create a function that will take in a vector (three double variables) representing a position in meters. Calculate the magnitude of the vector in meters: sqrt(x * x + y * y + z * z) Calculate the magnitude of the vector in feet: magnitudeInMeters * 3.28084 Using passing by reference, return both outputs from the same function. Input: Three unique doubles, each one representing a component of the vector. Output: Magnitude of the vector in meters, magnitude...

  • Problem 1. For the trapezoidal channel cross section shown below, find the following geometric quantities in...

    Problem 1. For the trapezoidal channel cross section shown below, find the following geometric quantities in terms of bottom width b, flow depth y, and side slope m. Provide the appropriate dimensions for each tem using the L-T-F (Length-Time-Force) system. For example, [b] L (a) Flow area, A (b) Wetted perimeter, P (c) Hydraulic radius, R (d) Top water surface width, T A (e) Hydraulic depth, D= T Problem 2. Write a function in Matlab that calculates each of the...

  • a) A step function has following characteristic 1for t > 0 -1 for t < 0...

    a) A step function has following characteristic 1for t > 0 -1 for t < 0 sgn(t) Use MATLAB plot this function over [-10, 10]. One display panel has two figures over two rows This is figure 1. It is displayed on top row of display panel. Give title; label x- and y- axes b) Plotting the Graph of a Sinc Function The sinc function is defined as sinx f(x) х whose value at x = 0 is sinx (sinx)...

  • Please show the code necessary, and explanations on MATLAB. Plotting 11) Plot the function y =...

    Please show the code necessary, and explanations on MATLAB. Plotting 11) Plot the function y = sin(x) from x = 0 to 21. 12) Plot the functions y = x2 z = x2 + 2x + 1 from x = 0 to 2 on the same graph. Scripts: Input and Output 13) Write a script (M-file) to read in a message at the command line using the MATLAB input function and then display the message to the Command Window using...

  • Consider the following potential function and the graph of its equipotential curves to the right. Then...

    Consider the following potential function and the graph of its equipotential curves to the right. Then answer parts a through d. phiφ​(x,y)equals=2 e Superscript x minus y Consider the following potential function and the graph of its equipotential curves to the right. Then answer parts a through d. 4(x.y)=2*-y a. Find the associated gradient field F = V p. F=CD b. Show that the vector field is orthogonal to the curve at the point (1,1). What is the first step?...

  • Problem 31: (34 points) 1. (10 points) A pulse width modulated (PWM) signal fPwM(t) in Figure...

    Problem 31: (34 points) 1. (10 points) A pulse width modulated (PWM) signal fPwM(t) in Figure 2. The symbol D represents a duty cycle, a number between zero and one. Determine the compact trigonometric Fourier series coefficients (Co C,11 %) of the signal f(t). 2. (10 points) One use of PWM is to generate variable DC voltages. While the PWM signal is not DC, you should be able to see from your results in part 1 that it hss a...

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