MATLAB Matlab graphing/plotting problem

  • Thread starter Thread starter sara_87
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
To graph the points (8,0), (4,-4), (-4,4), and (-8,0) in MATLAB, the user needs to connect the first two points and the last two points on the same graph. The correct commands involve using the 'plot' function for each pair of points. The user should use "hold on" to ensure both sets of points are displayed together. The commands would be: plot([4 8], [-4 0]) for the first pair and plot([-8 -4], [0 4]) for the second pair. This will effectively create the desired graph with both connections visible.
sara_87
Messages
748
Reaction score
0

Homework Statement



i have 4 points,
(8,0)
(4,-4)
(-4,4)
(-8,0)
i want to draw a graph of this on MATLAB so that the first to points are joined, the last two points are joined, but i want it on the same graph.
how do i do this? what's the command?
thank you

Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org
plot([4 8], [-4 0])
plot([-8 -4], [0 4])

remember to hold graphs if you are entering commands individually.
 
thank you!
 

Similar threads

Replies
32
Views
4K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
5
Views
3K
Replies
5
Views
2K
Replies
2
Views
3K
Replies
1
Views
4K
Back
Top