W.R. Wilcox, February 2006 Comparison of common formats in mathematics, MATLAB and Excel (Assume that in MATLAB x has been given a value and in Excel the value of x is in cell A1 and y in cellA2.) Mathematics MATLAB Excel 3x 3*x =3*A1 x2 x^2 =A1^2 1 2x 2 log(x) (1+2*x^2)/3/(4-5*x^4) or (1+2*x^2)/(3*(4-5*x^4)) log10(x) =(1+2*A1^2)/3/(4-5*A1^4) or =(1+2*A1^2)/(3*(4-5*A1^4)) =log(A1) ln(x) log(x) =ln(A1) ex exp(x) =exp(A1) π pi =pi() cos2x cos(x)^2 =cos(A1)^2 cos(x2) cos(x^2) =cos(A1^2) x sqrt(x) =sqrt(A1) |x| abs(x) =abs(A1) 5X1013 5e+13 5E+13 2X10-20 2e-20 2E-20 3(4 5x 4 ) If x > 1 set y=1, if x > 1 otherwise set y=1 y=-1. else y=–1 end If 3 < x ≤ 5 set if x > 3 & x <= 5 y=1, otherwise y=1 set y=-1. else y = -1 end Enter the following into cell A2(y): =IF(A1>1,1,-1) (Search IF in Excel help) Enter the following into cell A2(y): =IF(A1<=3,-1, IF(A1>3,IF(A1<=5,1,-1))) Note that for trigonometric functions in MATLAB and Excel, angles must be in radians rather than degrees. To convert from degrees to radians multiply by /180.