Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Hiya-Hiya, Amier-Qhaf J.

November 28,2022

BSME 3B

Computer Application

Introduction 9

Instructions: list all the functions given in the videos.


Function description example
>>syms x This command defines x as >>syms x
a variable symbol
>>f=inline(‘x^2’,’x’) >>f=inline(‘x^2’,’x’)

f=

Inline function:
f(x)=x^2
diff(f) This command >>diff(f)
differentiates f with respect
to x
ans=

2*x
g=inline(‘sin(x)/cos(x),’x’) Make g as a new function
diff(g(x),x) This command >>diff(g(x), x)
differentiates the value of g
ans=

sin(x)^2/cos(x)^2+1
pretty(ans) Visualize the last equation 2
sin(x)
--------- +1
2
cos(x)
>>Derivative=inline(diff(f(x),x),’x’) The function that is being >>Derivative=inline(diff(f(x),x),’x’)
generated is the derivative
of the inline function that
was created, and an x also derivative=
functions as the new
function's independent
variable. Inline function:
derivative(x)= x.*2.0
>>g=inline(‘x^3-1’,’x’) Make g as a new function Inline function:
g(x)=x^3-1
>>derivative=inline(diff(g(x),x),’x’) Calculate its derivative and >>derivative=inline(diff(g(x),x),’x’)
put into new function

deriv=

Inline function:
deriv(x)=x.^2.*3.0
>>syms x Function x and y as a >>syms x
variable
>>syms y >>syms y
>>f=inline(‘sin(x)+y^3,’x’,’y’) >>f=inline(‘sin(x)+y^3,’x’,’y’)

f=

Inline function:
f(x,y)=sin(x)+y^3
>>diff(f(x,y),x) Taking the derivative with >>diff(f(x,y),x)
respect to x

ans=

cos(x)
>>diff(f(x,y),y) Taking the derivative with >>diff(f(x,y),y)
respect to y

ans=

3*y^2

>>h=inline(‘x^10- Function h as a variable >>h=inline(‘x^10-y^2+log(z)’,’x’,’y’,’z’


y^2+log(z)’,’x’,’y’,’z’
h=

Inline functions:
h(x,y,z)=x^10-y^2+log(z)
>>diff(h(x,y,z),x Using x as the variable on >>diff(h(x,y,z),x
which to compute the
derivative makes all other
variables constant. ans=

10*x^9
>>f = int(expr) computes the indefinite >>f = int(expr)
integral of expr. int uses
the default integration
variable determined by f=
(expr,1). If expr is a
constant, then the default 1x2+1
integration variable is x.

>>fx = int computes the indefinite fx = int


integral of expr with
(f,x) (f,x)
respect to the symbolic
scalar variable var.

fx(x, z) =
x22 (z2+1)
>>syms x computes the definite >>syms x
integral
>>expr = x*log(1+x); >>expr = x*log(1+x);
of expr from a to b. int uses
>>F = int(expr,[0 1]) the default integration >>F = int(expr,[0 1])
variable determined
by (expr,1). If expr is a
constant, then the default f=
integration variable is x.
1/4

>>jason=inline(‘x^2,x^2’,’x’) function jason as a variable >>jason=inline(‘x^2,x^2’,’x’)

jason=

Inline function:
jason(x)=x^2
>>syms x Taking the limit of the >>syms x
function defined
>>limit(jason(x),x,5) >>limit(jason(x),x,5)

ans=

25
>>scatter( x , y ) scatter( x , y ) creates a
scatter plot with circular
markers at the locations
specified by the vectors x
and y.To plot one set of
coordinates, specify x and
y as vectors of equal
length. To plot multiple
sets of coordinates on the
same set of axes, specify at
least one of x or y as a
matrix.
>>grid on and grid on adds major grid
lines to the current axes.
>>grid off

grid off removes major and


minor grid lines from the
current axes
legend egend creates a legend with
descriptive labels for each
plotted data series. For the
labels, the legend uses the
text from the DisplayName
properties of the data
series. If the DisplayName
property is empty, then the
legend uses a label of the
form 'dataN'

You might also like