- Forums
- Mathematics
- MATLAB, Maple, Mathematica, LaTeX
- MATLAB
- Thread startertheBEAST
- Start date
- Tags
- MatlabPlotPoint
In summary, the conversation discusses a problem with plotting a column vector, where a straight line is shown instead of a point. The solution is to use the command "plot(x,y 'o')" to plot points, and for multiple elements, "plot(x(1, :), x(2, :))". The user also mentions the possibility of extracting numbers from the column vector to plot them.
- #1
Physics news on Phys.org
- #2
jhae2.718
Gold Member
- 1,184
- 20
Code:
plot(x,y);
where (x,y) is a point.
To show points, also:
Code:
plot(x,y 'o');
- #3
theBEAST
- 364
- 0
jhae2.718 said:
Code:
plot(x,y);
where (x,y) is a point.
To show points, also:
Code:
plot(x,y 'o');
Thanks but for this assignment I have to plot the x column vector that I get from doing another calculation that I did not show. Maybe I can extract the numbers out of the column but we have not been taught that.
- #4
jhae2.718
Gold Member
- 1,184
- 20
plot(x(1),x(2));
for multiple elements,
plot(x(1, :), x(2,
- #5
alphy
- 1,403
- 1
I can provide some guidance on how to plot a point on MATLAB. Firstly, make sure you are using the correct syntax for plotting a point. In MATLAB, a point is represented by a single data point, not a column vector. So, instead of using x=[1;1], you should use x=1. This will plot a single point at the coordinates (1,1).
If you want to plot multiple points, you can use the plot function with two vectors, one for the x-coordinates and one for the y-coordinates. For example, if you want to plot the points (1,1) and (2,3), you can use the following code:
x = [1, 2];
y = [1, 3];
plot(x,y,'o') %the 'o' specifies that the points should be plotted as circles
This will plot two points on the same figure.
In regards to the issue of getting a straight line instead of a point, it could be due to the plot settings. You can try adjusting the plot properties such as the axis limits, plot style, and marker size to get a clearer visualization of the point.
Additionally, it is always helpful to consult the MATLAB documentation or online resources for further guidance on plotting points and customizing plots. I hope this helps in resolving your issue. Happy plotting!
Related to Why Does My MATLAB Plot Show a Line Instead of a Point?
1. How do I plot a single point on MATLAB?
To plot a single point on MATLAB, you can use the "plot" function with the x and y coordinates of the point as inputs. For example, if you want to plot the point (2,3), you would use the command "plot(2,3)".
2. Can I plot multiple points on MATLAB at once?
Yes, you can plot multiple points on MATLAB at once by specifying the x and y coordinates of each point in a vector. For example, if you want to plot the points (1,2), (3,4), and (5,6), you would use the command "plot([1,3,5],[2,4,6])".
3. How do I customize the appearance of the plotted point?
You can use the optional input arguments of the "plot" function to customize the appearance of the plotted point. For example, you can change the color, shape, and size of the point by specifying the "Color", "Marker", and "MarkerSize" arguments, respectively.
4. Can I plot a point with a label or text on it?
Yes, you can use the "text" function to add a label or text to a plotted point. This function takes the x and y coordinates of the point as well as the text to be displayed as inputs. For example, the command "text(2,3,'A')" would plot the point (2,3) and label it as "A".
5. Is it possible to plot a 3D point on MATLAB?
Yes, MATLAB has a "plot3" function that allows you to plot points in three-dimensional space. This function takes three inputs - the x, y, and z coordinates of the point - and can be used to plot multiple points as well.
Similar threads
MATLAB[~,~,~,~,~,~,~,~,spec] Too many output arguments...
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 5
- Views
- 498
MATLABPlotting Reaction Rate vs Temperature with MATLAB
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 4
- Views
- 1K
MATLABHow to Plot a 4th Degree Polynomial in MATLAB: Step-by-Step Guide
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 7
- Views
- 1K
MATLABFEM, Matlab and the modes of an element
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 32
- Views
- 2K
MATLABHow to Plot y=sin(x)/log(x) in MATLAB Without Imaginary Errors?
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 11
- Views
- 2K
MATLABClosed form not the same as the discrete form
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 1
- Views
- 1K
MATLABMATLAB: Fluid Flow - Curl of a Vector Field
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 2
- Views
- 1K
MATLABHow to change the frequency values inside a time domain signal phase
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 1
- Views
- 869
MATLABReplacing the "quad" function with "integral" doesn't work in Matlab
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 1
- Views
- 3K
MATLABA Lorenz's system of ODEs doesn't get executed in Matlab
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 5
- Views
- 2K
- Forums
- Mathematics
- MATLAB, Maple, Mathematica, LaTeX