You are on page 1of 24

Ejercicio: hacer el grafico de la funcin

f ( X )=2 x 3 -4x+2
En el intervalo [-5,5]
syms x y z r
>> y=2.*x^3-4.*x+2

y=

2*x^3-4*x+2

>> x=linspace(-5,5,30)
>> y=2.*x.^3-4.*x+2
>>plot(x,y,'*r')
>> help plot
Use the Help browser Search tab to search the documentation, or
type "help help" for help command options, such as help for methods.

>> help plot


PLOT

Linear plot.

PLOT(X,Y) plots vector Y versus vector X. If X or Y is a matrix,


then the vector is plotted versus the rows or columns of the matrix,
whichever line up. If X is a scalar and Y is a vector, disconnected
line objects are created and plotted as discrete points vertically at
X.

PLOT(Y) plots the columns of Y versus their index.


If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)).
In all other uses of PLOT, the imaginary part is ignored.

Various line types, plot symbols and colors may be obtained with
PLOT(X,Y,S) where S is a character string made from one element
from any or all the following 3 columns:

blue

green

red

cyan

point
o

circle

dotted

x-mark

-.

dashdot

plus

--

dashed

star

yellow

square

black

diamond

white

>triangle (right)
p

pentagram

hexagram

>>plot(x,y,'*m')

>>syms x y z

(none) no line

triangle (down)
^

<triangle (left)

solid
:

magenta

triangle (up)

>> a=x+5

a=

x+5

>> b=x-1

b=

x-1

>> c=x-9

c=

x-9
>> z=a*b*c

z=

(x+5)*(x-1)*(x-9)

>> k=expand(z)

k=

x^3-5*x^2-41*x+45

>> y=x.^3-5.*x.^2-41*x+45

y=

x^3-5*x^2-41*x+45

>> x=linspace(-7,10,100)
>> y=x.^3-5.*x.^2-41*x+45
>>plot(x,y,'*r')
>>plot(x,y,'*c')
150
100
50
0
-50
-100
-150
-200
-250
-300
-8

>>syms x y z

-6

-4

-2

10

>> x=linspace(-15,15,100)
>> y=log((x).^2+1)
>>plot(x,y,'*r')
>>plot(x,y,'*b')
>>plot help
>>plot(x,y,'hb')
6

0
-15

-10

-5

>>syms x y z
>> y=exp(x)

y=

exp(x)

>> x=linspace(-10,10,100)

10

15

>> y=exp(x)
>>plot(x,y,'*r')

2.5

x 10

1.5

0.5

0
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=exp(-x)
>>plot(x,y,'*r')

-2

10

2.5

x 10

1.5

0.5

0
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=log(x+1)
>>plot(x,y,'*r')

-2

10

2.5
2
1.5
1
0.5
0
-0.5
-1
-1.5
-2
-2.5
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=sin(x)
>>plot(x,y,'*r')

-2

10

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=cos(x)
>>plot(x,y,'*r')

-2

10

1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=tan(x)
>>plot(x,y,'*r')

-2

10

30

20

10

-10

-20

-30
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=asin(x)
>>plot(x,y,'rp')

-2

10

2
1.5
1
0.5
0
-0.5
-1
-1.5
-2
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=atan(x)
>>plot(x,y,'rp')

-2

10

1.5

0.5

-0.5

-1

-1.5
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=sinh(x)
>>plot(x,y,'rp')

-2

10

1.5

x 10

0.5

-0.5

-1

-1.5
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=cosh(x)
>>plot(x,y,'rp')

-2

10

12000

10000

8000

6000

4000

2000

0
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=(x).^3
>>plot(x,y,'rp')

-2

10

4
3
2
1
0
-1
-2
-3
-4
-10

-8

-6

-4

>>syms x y z
>> x=linspace(-10,10,100)
>> y=(x).^5
>>plot(x,y,'rp')

-2

10

2
1.5
1
0.5
0
-0.5
-1
-1.5
-2
-10

-8

-6

x=linspace(-10,10,100)
y=x.^2}
plot(x,y,'rp')
syms x y z
x=linspace(-10,10,100)
y=x.^3
plot(x,y,'rp')syms x y z
x=linspace(-10,10,100)
y=x.^3
plot(x,y,'rp')syms x y z
x=linspace(-10,10,100)
y=x.^3
plot(x,y,'rp')

-4

-2

10

100
90
80
70
60
50
40
30
20
10
0
-10

-8

-6

-4

syms x y z
x=linspace(-10,10,100)
y=x.^3
plot(x,y,'rp')

-2

10

1000
800
600
400
200
0
-200
-400
-600
-800
-1000
-10

-8

-6

syms x y z
x=linspace(-10,10,100)
y=x.^(2./3)
plot(x,y,'rp')

syms x y z
x=linspace(-10,10,100)
y=1./(1+x.^2)

-4

-2

10

plot(x,y,'rp')

5
4
3
2
1
0
-1
-2
-3
-10

-8

-6

syms x y z
x=linspace(-10,10,100)
y=1./(1+x.^2)
plot(x,y,'rp')

-4

-2

10

1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-10

-8

-6

-4

-2

syms t
t=linspace(0,0.5,150)
y=-5/2366.*exp(-26.*t)+2/35.*exp(-5.*t)-93/1690+3/13.*t
plot(x,y,'*r')

10

You might also like