In this exercise, you will create a function trough_plot which will plot the cro
ID: 3890784 • Letter: I
Question
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:
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
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.Explanation / Answer
function trough_plot(x,y,y0)
function [] = trough_plot(x,y,y0)
figure;
plot(x,y,'k--','LineWidth',5);
hold on
plot(x,y0,'c:','LineWidth',4);
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.