Matlab graphing/plotting problem

  • Context: MATLAB 
  • Thread starter Thread starter sara_87
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

The discussion focuses on plotting specific points in MATLAB, specifically the points (8,0), (4,-4), (-4,4), and (-8,0). The user aims to connect the first two points and the last two points on the same graph. The correct MATLAB commands to achieve this are plot([4 8], [-4 0]) and plot([-8 -4], [0 4]), with the important note to use the hold on command to overlay the plots correctly.

PREREQUISITES
  • Familiarity with MATLAB syntax and commands
  • Understanding of 2D plotting in MATLAB
  • Knowledge of coordinate systems
  • Basic graphing concepts
NEXT STEPS
  • Learn how to use the hold on command in MATLAB for overlaying plots
  • Explore advanced MATLAB plotting functions such as plot3 for 3D graphs
  • Research MATLAB's line function for more complex line plotting
  • Investigate MATLAB's legend function to label multiple plots
USEFUL FOR

This discussion is beneficial for students, educators, and professionals who are learning MATLAB graphing techniques, particularly those needing to connect multiple points on a single graph effectively.

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 ·
2
Replies
32
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K