Você está na página 1de 23

POLYNOMIAL

Z=[4 3 -10 7 10]

Z=

3 -10

>> polyval(Z,1)

ans =

14

>> polyval(Z,2)

ans =

72

>> polyval(Z,3)

ans =

346

>> polyval(Z,10)

10

ans =

42080

>> polyval(Z,6)

ans =

5524
>> Y=[1 0 0 0 1]

Y=

>> V=conv(Z,Y)

V=

Columns 1 through 7

3 -10

14

Columns 8 through 9

10

3 -10

>> D=deconv(V,Y)

D=

3 -10

10

POLYADD
%m-file POLYADD15-> h1c010040
function[poly] = polyadd(poly1,poly2)
if length(poly1)<length(poly2)
short = poly1;
long = poly2;
else
short = poly2;
long = poly1;
end
mz = length(long) - length(short)
if mz>0
poly = [zero(1,mz),short] + long;
else
poly = long + short;
end

VECTOR
a=[8 1 8 0 8 4 3 5 4 6 8]

a=

Columns 1 through 7

Columns 8 through 11

>> a=[8 1 8 0 8 4 3 5 4 6 8]
b=[8 5 2 2 9 6 6 6 7 2 4]

A=[11 12 13 14;15 16 17 18;19 110 111 112]


B=[21 22 23 24;25 26 27 28;29 210 211 212]

a=

Columns 1 through 7

Columns 8 through 11

b=

Columns 1 through 7

Columns 8 through 11

A=

11

12

13

14

15

16

17

18

19 110 111 112

B=

21

22

23

24

25

26

27

28

29 210 211 212

>> a+b

ans =

Columns 1 through 7

16

10

17

Columns 8 through 11

11

>> a-b

11

12

10

ans =

Columns 1 through 7

-4

-2

-1

-2

-3

Columns 8 through 11

-1

-3

>> a*b
??? Error using ==> mtimes
Inner matrix dimensions must agree.

>> a dot b
??? Error: "a" was previously used as a variable,
conflicting with its use here as the name of a function or command.

>> a cross b
??? Error: "a" was previously used as a variable,
conflicting with its use here as the name of a function or command.

>> a/b

ans =

0.8479

>> a/b

ans =

0.8479

>> A+B

ans =

32

34

36

38

40

42

44

46

48 320 322 324

>> A-B

ans =

-10 -10 -10 -10


-10 -10 -10 -10
-10 -100 -100 -100

>> A*B
??? Error using ==> mtimes

Inner matrix dimensions must agree.

>> A DOT B
??? Error: "A" was previously used as a variable,
conflicting with its use here as the name of a function or command.

>> A CROSS B
??? Error: "A" was previously used as a variable,
conflicting with its use here as the name of a function or command.

>> A/B

ans =

3.5000 -2.5000 -0.0000


2.5000 -1.5000 -0.0000
2.0000 -1.5000

0.5000

>> A\B

ans =

1.0000 -1.0000 -1.0000 -1.0000


-5.0000 -2.5000 -3.0000 -3.5000
0
5.0000

0
4.5000

0
5.0000

5.5000

ITERASI DANN PLOTTING


t=0:0.25:7;
>> y=sin(t);
>> plot(t,y)
PLOT SIN(T)

x= linspace(0.2*pi,30);
>> y=sin(x);
>> z=cos(x);
>> plot(x,y,x,z)

plot(x,y,'g:p',x,z,'c-',x,z,'m+')

box off

xlabel('Variabel X')

ylabel('Variabel Y dan Z')

title('Grafik Sinus dan Cosinus')

grid on,box on

text(2.5,0.7,'sin(x)')

gtext('cos(x)')

legend('sin(x)','cos(x)')

Fungsi dasar
a=pi
niklai pi
a=

3.1416
sinus
b=sin(90)

b=

0.8940
Logaritma
Y=log(8)
Y=

2.0794
eksponensial

y = exp(1)

y=

2.7183

Você também pode gostar