You are on page 1of 8

To get started, select MATLAB Help or Demos from the Help menu.

>> syms x

>> f=x^2

f=

x^2

>> f=x*cos(x)-2*x^2+3*x-1

f=

x*cos(x)-2*x^2+3*x-1

>> f(0)

??? Subscript indices must either be real positive integers or logicals.

>> subs(f,0)

ans =

-1
>> syms xabc

>> P=a*x^2+b*x+c

??? Undefined function or variable 'a'.

>> syms x a b c

>> P=a*x^2+b*x+c

P=

a*x^2+b*x+c

>> subs(P,(a,b,c),(1,2,3))

??? subs(P,(a,b,c),(1,2,3))

Error: Incomplete or misformed expression or statement.

>> Subs(P,{a,b},{1,2})

Warning: Function call Subs invokes inexact match


C:\MATLAB7\toolbox\symbolic\@sym\subs.m.

ans =

x^2+2*x+c

>> f
f=

x*cos(x)-2*x^2+3*x-1

>> ezplot(f),grid on

>> limit(f,x,0)

ans =

-1

>> g=(x^2-1)/(x-1)

g=

(x^2-1)/(x-1)

>> limit(g,x,1)

ans =

2
>> f=floor(x)

f=

floor(x)

>> explot(f),grid on

??? Undefined command/function 'explot'.

>> ezplot(f),grid on

>> ezplot (f,[-1,2],grid on

??? ezplot (f,[-1,2],grid on

Error: Missing MATLAB operator.

>> ezplot (f,[-1,2]),grid on

>> limit(f,x,1,righ')

??? Undefined function or variable 'righ'.

>> limit(f,x,1,'right')

ans =

1
>> limit(f,x,1,'left')

ans =

>> limit(3*x^2+2*x+1)/(x^2+1),x,inf)

??? limit(3*x^2+2*x+1)/(x^2+1),x,inf)

Error: Unbalanced or misused parentheses or brackets.

>> limit((3*x^2+2*x+1)/(x^2+1),x,inf)

ans =

>> f=x*cos(x)-2*x^2+3*x-1

f=

x*cos(x)-2*x^2+3*x-1
>> diff(f)

ans =

cos(x)-x*sin(x)-4*x+3

>> syms x y

>> z=x^2+x*y+x+y+y^2

z=

x^2+x*y+x+y+y^2

>> diff(z,x)

ans =

2*x+y+1

>> diff(z,y)

ans =

x+1+2*y
>> syms x1 x2 x3

>> f1=3*x1-cos(x2*x3)-1/2

f1 =

3*x1-cos(x2*x3)-1/2

>> diff(f1,x1)

ans =

>> diff(f1,x2)

ans =

sin(x2*x3)*x3

>> subs(diff(f1,x2),(x1,x2,x3),(0,0,0))

??? subs(diff(f1,x2),(x1,x2,x3),(0,0,0))

|
Error: Incomplete or misformed expression or statement.

>> subs(diff(f1,x2),{x1,x2,x3},¨{0,0,0})

??? subs(diff(f1,x2),{x1,x2,x3},¨{0,0,0})

Error: Missing variable or function.

>> subs(diff(f1,x2),{x1,x2,x3},{0,0,0})

ans =

>> f2=x1^2-81*(x2+1/10)^2+sin(x3)+1.06

f2 =

x1^2-81*(x2+1/10)^2+sin(x3)+53/50

>> subs(diff(f2,x1),{x1,x2,x3},{0,0,0})

ans =

You might also like