Está en la página 1de 8

PG. 15 ; 1.

5
Clculos Simblicos
>> 'x+a*x^2-b*x^3'
ans =
x+a*x^2-b*x^3
>> f='A*sin(x)*exp(-x^2)'
f=
A*sin(x)*exp(-x^2)
>> syms a x b A % a,x,b y A como simbolos
>> f=A*sin(x)*exp(-x^2)
f=
A*exp(-x^2)*sin(x)
>> g='x+a*x^2-b*x^3'
g=
x+a*x^2-b*x^3
>> subs(g,'a',3) % Sustituye 3 en "a"
ans =
- b*x^3 + 3*x^2 + x
>> g1=subs(g,'x','(y-c)')
g1 =
y - c + a*(c - y)^2 + b*(c - y)^3
>> syms x y A B
>> f=A*sin(x)*exp(-B*x^2)
f=
A*exp(-B*x^2)*sin(x)
>> subs(f,B,4)
ans =
A*exp(-4*x^2)*sin(x)
>> f=inline('x^2*exp(-x)'
f=

Inline function:

f(x) = x^2*exp(-x)
>> f(3)
ans =
0.4481
>> f=inline('5+x-5*x^2+a*x^3')
f=
Inline function:
f(a,x) = 5+x-5*x^2+a*x^3
>> f=vectorize(f)
f=
Inline function:
f(a,x) = 5+x-5.*x.^2+a.*x.^3
>> x=-5:0.1:5;
>> plot(x,f(-1,x),x,f(0,x),x,f(1,x))

EJEMPLO :
>> H=('vo*m+1/2*g*m^2')
H=
vo*m+1/2*g*m^2
>> y=subs(H,'m','t')
y=
(g*t^2)/2 + vo*t
>> y=inline('(g*t^2)/2 + vo*t')
y=
Inline function:
y(g,t,vo) = (g*t^2)/2 + vo*t
>> y=vectorize(y)
y=
Inline function:
y(g,t,vo) = (g.*t.^2)./2 + vo.*t

>> t=-6:01.:6 ;

>> g=10;
>> plot(t,y(10,t,-1),t,y(10,t,0),t,y(10,t,1))

También podría gustarte