Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

sss / Владимиров-Демерт_1_2

.docx
Скачиваний:
20
Добавлен:
05.06.2015
Размер:
163.86 Кб
Скачать

< triangle (left)

> triangle (right)

p pentagram

h hexagram

For example, PLOT(X,Y,'c+:') plots a cyan dotted line with a plus

at each data point; PLOT(X,Y,'bd') plots blue diamond at each data

point but does not draw any line.

PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by

the (X,Y,S) triples, where the X's and Y's are vectors or matrices

and the S's are strings.

For example, PLOT(X,Y,'y-',X,Y,'go') plots the data twice, with a

solid yellow line interpolating green circles at the data points.

The PLOT command, if no color is specified, makes automatic use of

the colors specified by the axes ColorOrder property. The default

ColorOrder is listed in the table above for color systems where the

default is blue for one line, and for multiple lines, to cycle

through the first six colors in the table. For monochrome systems,

PLOT cycles over the axes LineStyleOrder property.

If you do not specify a marker type, PLOT uses no marker.

If you do not specify a line style, PLOT uses a solid line.

PLOT(AX,...) plots into the axes with handle AX.

PLOT returns a column vector of handles to lineseries objects, one

handle per plotted line.

The X,Y pairs, or X,Y,S triples, can be followed by

parameter/value pairs to specify additional properties

of the lines. For example, PLOT(X,Y,'LineWidth',2,'Color',[.6 0 0])

will create a plot with a dark red line width of 2 points.

Example

x = -pi:pi/10:pi;

y = tan(sin(x)) - sin(tan(x));

plot(x,y,'--rs','LineWidth',2,...

'MarkerEdgeColor','k',...

'MarkerFaceColor','g',...

'MarkerSize',10)

See also plottools, semilogx, semilogy, loglog, plotyy, plot3, grid,

title, xlabel, ylabel, axis, axes, hold, legend, subplot, scatter.

Overloaded methods:

timeseries/plot

channel.plot

dspdata.plot

wdectree/plot

ntree/plot

dtree/plot

wvtree/plot

rwvtree/plot

edwttree/plot

Reference page in Help browser

doc plot

>> help LineWidth

LineWidth not found.

Use the Help browser Search tab to search the documentation, or

type "help help" for help command options, such as help for methods.

>> x=-2*pi:pi/6:2*pi;

>> plot(x,y1,'r',x,y2,'g*',x,y3,'mp-.')

>> grid on, hold on, xlabel(x),ylabel(y);

>> x=-pi:pi/6:pi;

>> y1=sin(x);

>> y2=sin(x)-2;

>> y3=sin(x)+1;

>> plot(x,y1,'r',x,y2,'g*',x,y3,'mp-.')

>> grid on, hold on, xlabel(x),ylabel(y);

>> grid on, hold on, xlabel('x'),ylabel('y');

>> plot(x,y1,'r',x,y2,'g*',x,y3,'mp-.')

>> tittle('Графики функций y=sin(x), y=sin(x)-2, y=sin(x)+1')

??? Undefined function or method 'tittle' for input arguments of type 'char'.

>> title('Графики функций y=sin(x), y=sin(x)-2, y=sin(x)+1')

>> x=-2*pi:pi/20:2*pi;

y=cos(x);

plot(x,y)

hold on

plot(x,cos(2*x),'g')

plot(x,cos(0.5*x),'r')

grid on

xlabel('x'),ylabel('y')

title('Графики функций y=cos(x), y=cos(2x), y=cos(0,5x)')

>> x=-2*pi:pi/20:2*pi;

y=cos(x);

plot(x,y)

hold on

plot(x,cos(2*x),'g')

plot(x,cos(0.5*x),'r')

grid on

xlabel('x'),ylabel('y')

title('Графики функций y=cos(x), y=cos(2x), y=cos(0,5x)')

>> line ([-8 8],[0 0],'Color','black')

>> y1=cos(x);

>> y=2*cos(x);

>> y2=2*cos(x);

>> y3=0.3*cos(x);

>>

MATLAB desktop keyboard shortcuts, such as Ctrl+S, are now customizable.

In addition, many keyboard shortcuts have changed for improved consistency

across the desktop.

To customize keyboard shortcuts, use Preferences. From there, you can also

restore previous default settings by following the steps outlined in Help.

Click here if you do not want to see this message again.

>> a=[7 2 3; 5 -3 2; 10 -11 5]

a =

7 2 3

5 -3 2

10 -11 5

>> det(a)

ans =

-36.0000

>> x=-2*pi:pi/20:2*pi;

y=cos(x);

plot(x,y)

hold on

plot(x,cos(2*x),'g')

plot(x,cos(0.5*x),'r')

grid on

xlabel('x'),ylabel('y')

title('Графики функций y=cos(x), y=cos(2x), y=cos(0,5x)')

x=-2*pi:pi/20:2*pi;

y=cos(x);

plot(x,y)

hold on

plot(x,cos(2*x),'g')

plot(x,cos(0.5*x),'r')

grid on

xlabel('x'),ylabel('y')

title('Графики функций y=cos(x), y=cos(2x), y=cos(0,5x)')

line ([-8 8],[0 0],'Color','black')

>> x=-2*pi:pi/6:2*pi;

>> y1=cos(x);

y=2*cos(x);

y2=2*cos(x);

y3=0.3*cos(x);

>>

>> plot(x,y1,'r',x,y2,'g*',x,y3,'mp-.')

>> hold on, grid on

>> xlabel(x),ylabel(y);

>> xlabel('x'),ylabel('y');

>> o=[15 2 3; 15 -3 2; 36 -11 5]

o =

15 2 3

15 -3 2

36 -11 5

>> det(o)

ans =

-72.0000

>> x=-2:1/100:2

x =

Columns 1 through 12

-2.0000 -1.9900 -1.9800 -1.9700 -1.9600 -1.9500 -1.9400 -1.9300 -1.9200 -1.9100 -1.9000 -1.8900

Columns 13 through 24

-1.8800 -1.8700 -1.8600 -1.8500 -1.8400 -1.8300 -1.8200 -1.8100 -1.8000 -1.7900 -1.7800 -1.7700

Columns 25 through 36

-1.7600 -1.7500 -1.7400 -1.7300 -1.7200 -1.7100 -1.7000 -1.6900 -1.6800 -1.6700 -1.6600 -1.6500

Columns 37 through 48

-1.6400 -1.6300 -1.6200 -1.6100 -1.6000 -1.5900 -1.5800 -1.5700 -1.5600 -1.5500 -1.5400 -1.5300

Columns 49 through 60

-1.5200 -1.5100 -1.5000 -1.4900 -1.4800 -1.4700 -1.4600 -1.4500 -1.4400 -1.4300 -1.4200 -1.4100

Columns 61 through 72

-1.4000 -1.3900 -1.3800 -1.3700 -1.3600 -1.3500 -1.3400 -1.3300 -1.3200 -1.3100 -1.3000 -1.2900

Columns 73 through 84

-1.2800 -1.2700 -1.2600 -1.2500 -1.2400 -1.2300 -1.2200 -1.2100 -1.2000 -1.1900 -1.1800 -1.1700

Columns 85 through 96

-1.1600 -1.1500 -1.1400 -1.1300 -1.1200 -1.1100 -1.1000 -1.0900 -1.0800 -1.0700 -1.0600 -1.0500

Columns 97 through 108

-1.0400 -1.0300 -1.0200 -1.0100 -1.0000 -0.9900 -0.9800 -0.9700 -0.9600 -0.9500 -0.9400 -0.9300

Columns 109 through 120

-0.9200 -0.9100 -0.9000 -0.8900 -0.8800 -0.8700 -0.8600 -0.8500 -0.8400 -0.8300 -0.8200 -0.8100

Columns 121 through 132

-0.8000 -0.7900 -0.7800 -0.7700 -0.7600 -0.7500 -0.7400 -0.7300 -0.7200 -0.7100 -0.7000 -0.6900

Columns 133 through 144

-0.6800 -0.6700 -0.6600 -0.6500 -0.6400 -0.6300 -0.6200 -0.6100 -0.6000 -0.5900 -0.5800 -0.5700

Columns 145 through 156

-0.5600 -0.5500 -0.5400 -0.5300 -0.5200 -0.5100 -0.5000 -0.4900 -0.4800 -0.4700 -0.4600 -0.4500

Columns 157 through 168

-0.4400 -0.4300 -0.4200 -0.4100 -0.4000 -0.3900 -0.3800 -0.3700 -0.3600 -0.3500 -0.3400 -0.3300

Columns 169 through 180

-0.3200 -0.3100 -0.3000 -0.2900 -0.2800 -0.2700 -0.2600 -0.2500 -0.2400 -0.2300 -0.2200 -0.2100

Columns 181 through 192

-0.2000 -0.1900 -0.1800 -0.1700 -0.1600 -0.1500 -0.1400 -0.1300 -0.1200 -0.1100 -0.1000 -0.0900

Columns 193 through 204

-0.0800 -0.0700 -0.0600 -0.0500 -0.0400 -0.0300 -0.0200 -0.0100 0 0.0100 0.0200 0.0300

Columns 205 through 216

0.0400 0.0500 0.0600 0.0700 0.0800 0.0900 0.1000 0.1100 0.1200 0.1300 0.1400 0.1500

Columns 217 through 228

0.1600 0.1700 0.1800 0.1900 0.2000 0.2100 0.2200 0.2300 0.2400 0.2500 0.2600 0.2700

Columns 229 through 240

0.2800 0.2900 0.3000 0.3100 0.3200 0.3300 0.3400 0.3500 0.3600 0.3700 0.3800 0.3900

Columns 241 through 252

0.4000 0.4100 0.4200 0.4300 0.4400 0.4500 0.4600 0.4700 0.4800 0.4900 0.5000 0.5100

Columns 253 through 264

0.5200 0.5300 0.5400 0.5500 0.5600 0.5700 0.5800 0.5900 0.6000 0.6100 0.6200 0.6300

Columns 265 through 276

0.6400 0.6500 0.6600 0.6700 0.6800 0.6900 0.7000 0.7100 0.7200 0.7300 0.7400 0.7500

Columns 277 through 288

0.7600 0.7700 0.7800 0.7900 0.8000 0.8100 0.8200 0.8300 0.8400 0.8500 0.8600 0.8700

Columns 289 through 300

0.8800 0.8900 0.9000 0.9100 0.9200 0.9300 0.9400 0.9500 0.9600 0.9700 0.9800 0.9900

Columns 301 through 312

1.0000 1.0100 1.0200 1.0300 1.0400 1.0500 1.0600 1.0700 1.0800 1.0900 1.1000 1.1100

Columns 313 through 324

1.1200 1.1300 1.1400 1.1500 1.1600 1.1700 1.1800 1.1900 1.2000 1.2100 1.2200 1.2300

Columns 325 through 336

1.2400 1.2500 1.2600 1.2700 1.2800 1.2900 1.3000 1.3100 1.3200 1.3300 1.3400 1.3500

Columns 337 through 348

1.3600 1.3700 1.3800 1.3900 1.4000 1.4100 1.4200 1.4300 1.4400 1.4500 1.4600 1.4700

Columns 349 through 360

1.4800 1.4900 1.5000 1.5100 1.5200 1.5300 1.5400 1.5500 1.5600 1.5700 1.5800 1.5900

Columns 361 through 372

1.6000 1.6100 1.6200 1.6300 1.6400 1.6500 1.6600 1.6700 1.6800 1.6900 1.7000 1.7100

Columns 373 through 384

1.7200 1.7300 1.7400 1.7500 1.7600 1.7700 1.7800 1.7900 1.8000 1.8100 1.8200 1.8300

Columns 385 through 396

1.8400 1.8500 1.8600 1.8700 1.8800 1.8900 1.9000 1.9100 1.9200 1.9300 1.9400 1.9500

Columns 397 through 401

1.9600 1.9700 1.9800 1.9900 2.0000

>> y=exp(x);

>> plot(x,y,'r')

>> plot(x,y,'r')

>> hold on, grid on

>> xlabel('x'),ylabel('y');

>> x=e^-2

??? Undefined function or variable 'e'.

>> x=exp^-2

??? Error using ==> exp

Not enough input arguments.

>> x=exp(-2)

x =

0.1353

>> x=exp(-2):1/100:exp(2);

>> y=log(x);

>> plot(x,y,'g*')

>> x=-2:1/100:exp(2);

>> y=x;

>> plot(x,y,'mp-.')

>> axis equal

>> subplot(row,col,cur)

??? Undefined function or variable 'row'.

>> x=-2*pi:pi/20:2*pi;

y1=sin(x); y2=cos(x);

subplot(2,1,1);plot(x,y1);

grid on; title('y=sin(x)')

xlabel('x'),ylabel('y')

axis([-2*pi 2*pi -1 1]) %Обратите внимание, как изменилось окно графика (пояснение ниже)

line([-2*pi 2*pi],[0 0],'Color','black')

line([0 0],[-1 1],'Color','black')

subplot(2,1,2); plot(x,y2);

grid on; title('y=cos(x)')

xlabel('x'),ylabel('y')

axis([-2*pi 2*pi -1 1])

line([-2*pi 2*pi],[0 0],'Color','black')

line([0 0],[-1 1],'Color','black')

>> x=-5:1/10:5;

>> f=abs(abs(x)-2);

>> hold off

>> subplot(2,3,1);plot(x,f);

>> x=x-2;

>> x=-5:1/10:5;

>> x1=x-2;

>> f=abs(abs(x1)-2);

>> subplot(2,3,2);plot(x1,f);

>> x2=x+2;

>> f=abs(abs(x2)-2);

>> subplot(2,3,3);plot(x2,f);

>> x3=x*2;

>> f=abs(abs(x3)-2);

>> subplot(2,3,4);plot(x3,f);

>> x4=x*0.5;

>> f=abs(abs(x4)-2);

>> subplot(2,3,5);plot(x4,f);

>> x5=-x;

>> f=abs(abs(x5)-2);

>> subplot(2,3,6);plot(x5,f);

>> f=abs(abs(x)-2);

>> f1=-аж

??? f1=-аж

|

Error: The input character is not valid in MATLAB statements or expressions.

>> f1=-f;

>> subplot(2,3,1);plot(x,f1);

>> f2=f*2;

>> subplot(2,3,2);plot(x,f2);

>> f3=0.5*f;

>> subplot(2,3,3);plot(x,f3);

>> f4=f-2;

>> f4=f+2;

>> subplot(2,3,4);plot(x,f4);

>> f5=f-2;

>> subplot(2,3,6);plot(x,f5);

>> subplot(2,3,5);plot(x,f4);

>> subplot(2,3,4);plot(x,f3);

>> subplot(2,3,3);plot(x,f2);

>> subplot(2,3,2);plot(x,f1);

>> subplot(2,3,1);plot(x,f);

>> help fplot

FPLOT Plot function

FPLOT(FUN,LIMS) plots the function FUN between the x-axis limits

specified by LIMS = [XMIN XMAX]. Using LIMS = [XMIN XMAX YMIN YMAX]

also controls the y-axis limits. FUN(x) must return a row vector for

each element of vector x. For example, if FUN returns

[f1(x),f2(x),f3(x)] then for input [x1;x2] FUN should return

[f1(x1) f2(x1) f3(x1);

f1(x2) f2(x2) f3(x2)]

FPLOT(FUN,LIMS,TOL) with TOL < 1 specifies the relative error

tolerance. The default TOL is 2e-3, i.e. 0.2 percent accuracy.

FPLOT(FUN,LIMS,N) with N >= 1 plots the function with a minimum of N+1

points. The default N is 1. The maximum step size is restricted to be

(1/N)*(XMAX-XMIN).

FPLOT(FUN,LIMS,'LineSpec') plots with the given line specification.

FPLOT(FUN,LIMS,...) accepts combinations of the optional arguments

TOL, N, and 'LineSpec', in any order.

[X,Y] = FPLOT(FUN,LIMS,...) returns X and Y such that Y = FUN(X). No

plot is drawn on the screen.

FPLOT(AX,...) plots into AX instead of GCA.

Examples:

fplot(@humps,[0 1])

fplot(@(x)[tan(x),sin(x),cos(x)], 2*pi*[-1 1 -1 1])

fplot(@(x) sin(1./x), [0.01 0.1], 1e-3)

f = @(x,n)abs(exp(-1j*x*(0:n-1))*ones(n,1));

fplot(@(x)f(x,10),[0 2*pi])

See also plot, ezplot, function_handle.

Reference page in Help browser

doc fplot

EZPLOT Easy to use function plotter

EZPLOT(FUN) plots the function FUN(X) over the default domain

-2*PI < X < 2*PI, where FUN(X) is an explicitly defined function of X.

EZPLOT(FUN2) plots the implicitly defined function FUN2(X,Y) = 0 over

the default domain -2*PI < X < 2*PI and -2*PI < Y < 2*PI.

EZPLOT(FUN,[A,B]) plots FUN(X) over A < X < B.

EZPLOT(FUN2,[A,B]) plots FUN2(X,Y) = 0 over A < X < B and A < Y < B.

EZPLOT(FUN2,[XMIN,XMAX,YMIN,YMAX]) plots FUN2(X,Y) = 0 over

XMIN < X < XMAX and YMIN < Y < YMAX.

EZPLOT(FUNX,FUNY) plots the parametrically defined planar curve FUNX(T)

and FUNY(T) over the default domain 0 < T < 2*PI.

EZPLOT(FUNX,FUNY,[TMIN,TMAX]) plots FUNX(T) and FUNY(T) over

TMIN < T < TMAX.

EZPLOT(FUN,[A,B],FIG), EZPLOT(FUN2,[XMIN,XMAX,YMIN,YMAX],FIG), or

EZPLOT(FUNX,FUNY,[TMIN,TMAX],FIG) plots the function over the

specified domain in the figure window FIG.

EZPLOT(AX,...) plots into AX instead of GCA or FIG.

H = EZPLOT(...) returns handles to the plotted objects in H.

Examples:

The easiest way to express a function is via a string:

ezplot('x^2 - 2*x + 1')

One programming technique is to vectorize the string expression using

the array operators .* (TIMES), ./ (RDIVIDE), .\ (LDIVIDE), .^ (POWER).

This makes the algorithm more efficient since it can perform multiple

function evaluations at once.

ezplot('x.*y + x.^2 - y.^2 - 1')

You may also use a function handle to an existing function. Function

handles are more powerful and efficient than string expressions.

ezplot(@humps)

ezplot(@cos,@sin)

EZPLOT plots the variables in string expressions alphabetically.

subplot(1,2,1), ezplot('1./z - log(z) + log(-1+z) + t - 1')

To avoid this ambiguity, specify the order with an anonymous function:

subplot(1,2,2), ezplot(@(z,t)1./z - log(z) + log(-1+z) + t - 1)

If your function has additional parameters, for example k in myfun:

%-----------------------%

function z = myfun(x,y,k)

z = x.^k - y.^k - 1;

%-----------------------%

then you may use an anonymous function to specify that parameter:

ezplot(@(x,y)myfun(x,y,2))

See also ezcontour, ezcontourf, ezmesh, ezmeshc, ezplot3, ezpolar,

ezsurf, ezsurfc, plot, vectorize, function_handle.

Overloaded methods:

sym/ezplot

Reference page in Help browser

doc ezplot

>> subplot(1,2,1

??? subplot(1,2,1

|

Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.

>> subplot(1,2,1)

>> x=-2*pi:pi/6:2*pi;

>> y1=sinh(x);

>> y2=cosh(x);

>> fplot(x,y1, 0,1)

??? Error using ==> fcnchk at 108

FUN must be a function, a valid string expression, or an inline function object.

Error in ==> fplot at 61

fun = fcnchk(fun);

>> fplot(x y1, 0,1)

??? fplot(x y1, 0,1)

|

Error: Unexpected MATLAB expression.

>> fplot(x, y1, 0.1)

??? Error using ==> fcnchk at 108

FUN must be a function, a valid string expression, or an inline function object.

Error in ==> fplot at 61

fun = fcnchk(fun);

>> Fplot(sinh(x),5,0.1)

Warning: Could not find an exact (case-sensitive) match for 'Fplot'.

D:\MATLAB\toolbox\matlab\specgraph\fplot.m is a case-insensitive match and will be used instead.

You can improve the performance of your code by using exact

name matches and we therefore recommend that you update your

usage accordingly. Alternatively, you can disable this warning using

warning('off','MATLAB:dispatcher:InexactCaseMatch').

This warning will become an error in future releases.

??? Error using ==> fcnchk at 108

FUN must be a function, a valid string expression, or an inline function object.

Error in ==> fplot at 61

fun = fcnchk(fun);

>> Fplot(sinh(x))

??? Error using ==> fplot at 52

Not enough input arguments.

>> Fplot(sinh(x), cosh(x), 0.1)

??? Error using ==> fcnchk at 108

FUN must be a function, a valid string expression, or an inline function object.

Error in ==> fplot at 61

fun = fcnchk(fun);

>> Fplot(sinh(x), cosh(x))

??? Error using ==> fcnchk at 108

FUN must be a function, a valid string expression, or an inline function object.

Error in ==> fplot at 61

fun = fcnchk(fun);

>> Fplot(sinh(x); cosh(x))

??? Fplot(sinh(x); cosh(x))

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> fplot(sinh(x), [-10 -10 10 10], 0.1)

??? Error using ==> fcnchk at 108

FUN must be a function, a valid string expression, or an inline function object.

Error in ==> fplot at 61

fun = fcnchk(fun);

>> fplot(sinh(x), [-10 10], 0.1)

??? Error using ==> fcnchk at 108

FUN must be a function, a valid string expression, or an inline function object.

Error in ==> fplot at 61

fun = fcnchk(fun);

>> fplot('sinh(x)', [-10 10], 0.1)

>> subplot(1,2,1); fplot('sinh(x)',[-10 10], 0.1)

>> subplot(1,2,2); fplot('cosh(x)', [-10 10, 0.1)

??? subplot(1,2,2); fplot('cosh(x)', [-10 10, 0.1)

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> subplot(1,2,2); fplot('cosh(x)', [-10 10], 0.1)

>> hold on; grid on

>> subplot(1,2,1)

>> hold on; grid on

>> xlabel('x');ylabel('y'); title('y=sh x')

>> subplot(1,2,2);

>> xlabel('x');ylabel('y'); title('y=ch x')

>> x = 10.^(-3:1:3);

>> subplot(1,2,1)

>> y=x;

>> y1=1/x;

??? Error using ==> mldivide

Matrix dimensions must agree.

>> y1=1/x;

??? Error using ==> mldivide

Matrix dimensions must agree.

>> clear y1

>> y1=1/x;

??? Error using ==> mldivide

Matrix dimensions must agree.

>> x=[ 0.001, 0.01, 0.1, 1, 10, 100, 1000];

>> y=x;

>> y1=1/x;

??? Error using ==> mldivide

Matrix dimensions must agree.

>> y1=./x;

??? y1=./x;

|

Error: Unexpected MATLAB operator.

>> y1=1./x;

>> y2=1./sqrt(x);

>> plot(x,y,'-r*',x,y1,'b-->',x,y2,'go')

>> axis equal

>> subplot(1,2,2)

>> loglog(x,y,'-r*',x,y1,'b-->',x,y2,'go')

>> x=0:pi/6:pi;

>> y1=cos(x);

>> y2=1/y1;

??? Error using ==> mldivide

Matrix dimensions must agree.

>> y2=1./y1;

>> plot(x,y1,'g:',x,y2,'r-.')

>> hold on, grid on

>> line([0 0];[4 18])

??? line([0 0];[4 18])

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> line([0 0],[4 18])

>> line([0 0],[4 18],'color','black')

>> line([0 0],[4 18],'color','black')

>> line([0 0],[4 18],'color','black')

>> line([0 0],[4 18],'color','black')

>> line([0 0],[4 18],'color','black')

>> xlabel('x'),ylabel('y')

>> line([0 0],[0 18],'color','black')

>> line([2 2],[3 2],'color','black')

>> grid off

>> line([2 2],[3 2],'color','black')

>> line([0.5 2],[2 6],'color','black')

>> line([0.5 0.5],[0 14000000000000000],'color','black')

>> line([0.5 0.5],[-2000000000000000 14000000000000000],'color','black')

>> line([0.5 0.5],[-2000000000000000 18000000000000000],'color','black')

>> x=0:pi/6:pi;

>> y1=cos(x);

>> y2=1/.y1;

??? y2=1/.y1;

|

Error: Unexpected MATLAB operator.

>> y2=1./y1;

>> plot(x,y1,'r:',x, y2, 'g-.')

>> plot(x,y1)

>> fplot('cos(x)', [-10 10], 'r:')

>> hold on

>> fplot('1/cos(x)', [-10 10], 'r-.')

>> fplot('cos(x)', [-10 10], 'g:')

>> fplot('cos(x)', [-10 10 -1.5 1.5], 'g:')

>> fplot('1/cos(x)', [-10 10 -1.5 1.5], 'r-.')

>> hold on

>> fplot('cos(x)', [-10 10 -1.5 1.5], 'g:')

>> line([-10 10], [0 0], 'color', 'black')

>> line([0 0], [-1.5 1.5], 'color', 'black')

>> xlabel('x'), ylabel('y'); title('cos(x) and 1/cos(x)')

>> line([0 0],[-1.5 1.5], 'color', 'blue')

>>

>> x=-pi/2:pi/6:pi/2;

>> fplot('sin(x)', [-10 10 -1.5 1.5], 'b-')

>> hold on

>> fplot('1/sin(x)', [-10 10 -1.5 1.5], 'r:')

>> grid on

>> line([-10 10],[0 0], 'color', 'black')

>> line([0 0],[-1.5 1.5], 'color', 'black')

>> xlabel('x'), ylabel('y'); title('sin(x) and 1/sin(x)')

>> line([1.6 1.6],[-1.5 1.5], 'm-')

??? Error using ==> line

String argument is an unknown option.

>> line([1.6 1.6],[-1.5 1.5], 'color', 'purple')

??? Error using ==> line

Bad property value found.

Object Name : line

Property Name : 'Color'.

>> color help

ans =

1

2

3

4

>> line([1.6 1.6],[-1.5 1.5], 'color', '1')

??? Error using ==> line

Bad property value found.

Object Name : line

Property Name : 'Color'.

>> line([1.6 1.6],[-1.5 1.5], 'Color', 1)

??? Error using ==> line

Color value must be a 3 element numeric vector

>> line([1.6 1.6],[-1.5 1.5], 'Color', 'black')

>> line help

??? Error using ==> line

Not enough input arguments.

>> help line

LINE Create line.

LINE(X,Y) adds the line in vectors X and Y to the current axes.

If X and Y are matrices the same size, one line per column is added.

LINE(X,Y,Z) creates lines in 3-D coordinates.

LINE returns a column vector of handles to LINE objects,

one handle per line. LINEs are children of AXES objects.

The X,Y pair (X,Y,Z triple for 3-D) can be followed by

parameter/value pairs to specify additional properties of the lines.

The X,Y pair (X,Y,Z triple for 3-D) can be omitted entirely, and

all properties specified using parameter/value pairs.

Execute GET(H), where H is a line handle, to see a list of line

object properties and their current values. Execute SET(H) to see a

list of line object properties and legal property values.

See also patch, text, plot, plot3.

Reference page in Help browser

doc line

>> help color

COLOR Column partition for sparse finite differences.

GROUP = COLOR(J,P) returns a partition of the

column corresponding to a coloring of the column-

intersection graph. GROUP(I) = J means column I is

colored J.

All columns belonging to a color can be estimated

in a single finite difference.

Reference page in Help browser

doc color

>> line([1.6 1.6],[-1.5 1.5], 'Color', 'magenta')