How to Plot Straight Lines in Matlab
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=7r4xTellrNw
For more information and examples, visit: • https://matrixlab-examples.com/horizo... • https://matrixlab-examples.com • Download this presentation: • https://www.slideshare.net/matrixlab/... • --- • How to Plot a Straight Line in Matlab (it also works in GNU-Octave and FreeMat). • --- • You can plot a straight line just as you would plot any other function in Matlab. • The basic use of the built-in function plot is: • plot(x, y) • where • x = array of x-values • y = array of y-values • --- • For example, 2D plot this blue line: • % so create your x and y-arrays • x = [-1 3]; • y = [2 4]; • % just plot the line: • plot(x, y) • --- • You can plot more than one line by using the hold on command once (after the first plot)… • plot([-1 3], [2 4]) • hold on • plot([1 1], [5 2]) • --- • You can have different colors and widths: • plot([-1 3], [2 4], ‘r’, ‘Linewidth’, 2) • hold on • plot([1 1], [5 2], ‘k’, ‘Linewidth’, 3) • ‘r’ for red • ‘k’ for black • ‘g’ for green • ‘b’ (default) for blue • specify the property and add a number for the width
#############################
