Escolar Documentos
Profissional Documentos
Cultura Documentos
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=
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
B=
21
22
23
24
25
26
27
28
>> 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
>> A-B
ans =
>> A*B
??? Error using ==> mtimes
>> 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.5000
>> A\B
ans =
0
4.5000
0
5.0000
5.5000
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')
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