Plot X And Y Matlab

Example x y meshgrid x y returns 2 d grid coordinates based on the coordinates contained in vectors x and y.
Plot x and y matlab. Just like it is to change the color of your plot in matlab the same goes for changing the line style increasing the thickness of the line or some other aspect of it. For example type area x sin x grid and press enter. Plot y creates a 2 d line plot of the data in y versus the index of each value. The grid represented by the coordinates x and y has length y rows and length x columns.
This time the sine wave is shown as an area plot. For an automatically calculated minimum or maximum limit use inf or inf respectively. Matlab plotting line style. To plot the graph of a function you need to take the following steps define x by specifying the range of values for the variable x for which the function is to be plotted define the function y f x call the plot command as plot x y.
Let matlab choose the other limits. X and y both are vectors. Let s go ahead a plot the following code. Each specification can include characters for the line color style and marker.
A marker is a symbol that appears at each plotted data point such as a o or. If y is a vector then the x axis scale ranges from 1 to length y. To plot the curve for x and y values are given below in matlab. The table below shows the following line specifiers which are optional.
Plot x y r and the plot will be. Plot x y r r is a line specification. Surf x y z xlabel x axis ylabel y axis xlim inf 0 ylim 1 inf. I have been searching for an easy way to draw the x and y axis on a plot but cannot seem to do it.
If y is a matrix then the plot function plots the columns of y versus their row number. Set the maximum x axis limit to 0 and the minimum y axis limit to 1. It s possible to create any sort of plot using commands just as it is to use the graphic aids that matlab provides. X is a matrix where each row is a copy of x and y is a matrix where each column is a copy of y.