plot two variables in matlab

Assuming you have two variables x and y, you can plot them using the plot function in Matlab:

main.m
plot(x, y)
11 chars
2 lines

This will create a 2D line plot of y against x. You can also customize the plot by setting various properties, such as line color, line style, and axis labels. Here is an example:

main.m
x = 0:0.1:10;
y = sin(x);
plot(x, y, '-r', 'LineWidth', 2)
xlabel('x')
ylabel('y')
title('Sine Function')
106 chars
7 lines

This will plot the sine function with a red line and a line width of 2, and add x and y axis labels as well as a title to the plot. You can modify the code to plot your own variables as desired.

related categories

gistlibby LogSnag