having trouble writing a code that produce this graph.
1 view (last 30 days)
Show older comments
0 Comments
Answers (1)
Walter Roberson
on 24 Oct 2021
Hint:
plot([-3 0 0], [0 0 -4]); xlim([-5 5]); ylim([-5 5])
2 Comments
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.)
See Also
Categories
Find more on Directed Graphs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!