Skip to content

Latest commit

 

History

History
30 lines (28 loc) · 2.91 KB

File metadata and controls

30 lines (28 loc) · 2.91 KB

Physics cheat sheet for MATLAB

Function Definition Example
sqrt(x) Square root of x sqrt(25) returns 5
sin(x) Sine of angle x in radians sin(pi/2) returns 1
cos(x) Cosine of angle x in radians cos(0) returns 1
tan(x) Tangent of angle x in radians tan(pi/4) returns 1
exp(x) Exponential function e^x exp(1) returns 2.7183
log(x) Natural logarithm of x log(10) returns 2.3026
log10(x) Base-10 logarithm of x log10(100) returns 2
abs(x) Absolute value of x abs(-5) returns 5
ceil(x) Round up to the nearest integer ceil(3.2) returns 4
floor(x) Round down to the nearest integer floor(3.7) returns 3
round(x) Round to the nearest integer round(3.5) returns 4
mod(x, y) Remainder of x divided by y mod(10, 3) returns 1
power(x, y) Raise x to the power of y power(2, 3) returns 8
sinh(x) Hyperbolic sine of x sinh(1) returns 1.1752
cosh(x) Hyperbolic cosine of x cosh(1) returns 1.5431
tanh(x) Hyperbolic tangent of x tanh(1) returns 0.7616
asin(x) Inverse sine in radians asin(0.5) returns 0.5236 (pi/6)
acos(x) Inverse cosine in radians acos(0.5) returns 1.0472 (pi/3)
atan(x) Inverse tangent in radians atan(1) returns 0.7854 (pi/4)
deg2rad(x) Convert degrees to radians deg2rad(90) returns 1.5708 (pi/2)
rad2deg(x) Convert radians to degrees rad2deg(pi/2) returns 90
real(x) Real part of complex number x real(3 + 4i) returns 3
imag(x) Imaginary part of complex number x imag(3 + 4i) returns 4
abs(x) Magnitude of complex number x abs(3 + 4i) returns 5
angle(x) Phase angle of complex number x angle(1 + i) returns 0.7854 (pi/4)