23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

cos, cosh<br />

2cos, cosh<br />

Purpose Cosine and hyperbolic cosine<br />

Syntax Y = cos(X)<br />

Y = cosh(X)<br />

Description The cos and cosh functions operate element-wise on arrays. The functions’<br />

domains and ranges include complex values. All angles are in radians.<br />

2-340<br />

Y = cos(X) returns the circular cosine for each element of X.<br />

Y = cosh(X) returns the hyperbolic cosine for each element of X.<br />

Examples Graph the cosine function over the domain – π ≤ x ≤ π, and the hyperbolic<br />

cosine function over the domain – 5 ≤ x ≤ 5.<br />

y=cos(x)<br />

1<br />

0.8<br />

0.6<br />

0.4<br />

0.2<br />

0<br />

-0.2<br />

-0.4<br />

-0.6<br />

-0.8<br />

x = -pi:0.01:pi; plot(x,cos(x))<br />

x = -5:0.01:5; plot(x,cosh(x))<br />

-1<br />

-4 -3 -2 -1 0<br />

x<br />

1 2 3 4<br />

y=cosh(x)<br />

0<br />

-5 -4 -3 -2 -1 0<br />

x<br />

1 2 3 4 5<br />

The expression cos(pi/2) is not exactly zero but a value the size of the<br />

floating-point accuracy, eps, because pi is only a floating-point approximation<br />

to the exact value of π<br />

.<br />

80<br />

70<br />

60<br />

50<br />

40<br />

30<br />

20<br />

10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!