function [x,y,y0] = trough_create( Fun,EndPoint); x=linspace(0,EndPoint,64); y=f
ID: 3885972 • Letter: F
Question
function [x,y,y0] = trough_create( Fun,EndPoint);
x=linspace(0,EndPoint,64);
y=feval(Fun,x);
y0=y(1)*ones(size(x));
this code is not working
n 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 xavector 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 ye - a vector representing the y co-ordinates for the top of the trough Output variable: n/a this function has no output variables rocess: plots for y and y must be in the same figure, with the order below being strictly adhered to 1. Graph the bottom of the trough (y) The curve should be displayed using a black dashed line with a line width of 5 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 cyan dotted line with a line width of 4 otes 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 unction trough_plot(x,y,yø) % INSERTCODEHERE - - Submitted file function trough_plot(x,y,ye) % INSERT CODE HERE endExplanation / Answer
your plotting code should be
function trough_plot(x, y, y0)
p1 = plot(x,y,'k--');
p1.LineWidth = 5;
hold
p2 = plot(x,y0, 'c:');
p2.LineWidth = 4;
end
to create trough you can use this
function [x,y,y0] = trough_create( Fun,EndPoint);
x=linspace(0,EndPoint,64);
y=feval(Fun,x);
y0=y(1)*ones(size(x));
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.