having trouble writing a code that produce this graph.

1 view (last 30 days)

Answers (1)

Walter Roberson
Walter Roberson on 24 Oct 2021
Hint:
plot([-3 0 0], [0 0 -4]); xlim([-5 5]); ylim([-5 5])
  2 Comments
tiesha dandridge
tiesha dandridge on 24 Oct 2021
that doesnt help but ive got this far i just cant get thr unitstep after the slope change.
y2 =-2*heaviside(t+1)+(5/6)*(t).*heaviside(t+1)-(5/6)*(t).*heaviside(t-4)-3*heaviside(t-5)
Walter Roberson
Walter Roberson on 25 Oct 2021
I think you need to review the question asked. The question asked does not inherently have anything to do with heaviside. The question asked was to reproduce the given plot.
The example I showed you, demonstrates how to start at a particular coordinate (e.g, x -7, y 0), how to draw a horizontal line, how to draw a vertical line -- and by trivial extension, how to draw a sloped line. And the example demonstrated how to "frame" a plot for the case where the desired display area is larger than the data range.
Your graph consists of three horizontal lines, two vertical lines, and one sloped line. Replicating the plot is very easy once you see the "trick" for vertical lines (that is, duplicate the x values.)

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!