Anda di halaman 1dari 8

NOME: ANTONIO CARLOS FRISSO JUNIOR RA:059077

AULA PRTICA N ZERO FUNDAMENTOS DO MATLAB.


1) Seja a funo

a) Apresente o grfico da funo acima utilizando o intervalo de 0 t 1,5.


function y = f(t)
y = 4*sin(5*t) - cos(20*t) + sin(50*t)
>> t = 0.0:0.01:1.5;
plot(t,f(t))
6

-2

-4

-6

0.5

b) Calcule a rea abaixo da curva representada.


q = quad('f',0,1.5)
q = 0.5737

c) Encontrar o ponto de mnimo e represent-lo com a funo.


xm = fminbnd('f',0,1.5)

1.5

ym = f(xm)
y =-5.7977
plot(t, f(t), xm, ym,'o')

-2

-4

-6

0.5

1.5

2) Determine as razes dos polinmios abaixo e encontre os valores, para cada


funo, em x = 3,2.
a) f(x) = x3 - 5x2 + 2x + 8
f = [1 -5 2 8];
roots(f)
ans =
4.0000
2.0000
-1.0000
polyval(f,3.2)
ans =-4.0320
b) g(x) = x2 + 4x + 4
g = [1 4 4];
roots(g)
ans =
-2

-2
polyval(g,3.2)
ans =27.0400
c) h(x) = x5 + 3x4 - 11x3 + 27x2 + 10x 24
h = [1 3 -11 27 10 -24];
roots(h)
ans =
-5.6900
1.3733 + 1.8376i
1.3733 - 1.8376i
-0.9240
0.8674
>> polyval(h,3.2)
ans =574.1491
d) i(x) = x5 - 3x3 + 4x2 -1
i = [1 0 -3 4 0 -1];
roots(i)
ans =
-2.1772
0.9784 + 0.7996i
0.9784 - 0.7996i
0.6578
-0.4373
>> polyval(i,3.2)
ans =277.2003
Plote todas as funes acima (0 x 10) em um nico grfico (subplot).

3) Determine o polinmio que melhor se ajusta funo para o intervalo 5<t<5. Graficar trs tentativas, alterando a ordem do polinmio.
5 ordem

12

1.5

x 10

0.5

-0.5

-1

-1.5

-2
-5

4 ordem

-4

-3

-2

-1

12

1.5

x 10

0.5

-0.5

-1

-1.5

-2
-5

-4

-3

-2

-1

-4

-3

-2

-1

2 ordem
12

x 10

0.5

-0.5

-1

-1.5

-2
-5

4) Construa os grficos 3D e de contorno das funes abaixo:


a) >> X=-3:3;
>> Y=-3:3;
>> [X,Y]=meshgrid(-3:0.3:3,-3:0.3:3);
>> Z=(X.^2+(3*Y.^2)).*exp(-X.^2-Y.^2);
>> mesh(X,Y,Z)

>> contour(Z,10)

b)
>> [X,Y]=meshgrid(-1.5:0.01:1.5,-2.5:0.01:2.5);

>> Z=(exp(-(4*X.^2+2*Y.^2)).*cos(8*X))+(exp(3*(((2*X+1)./2).^2+2*Y.^2)));
>> mesh(X,Y,Z)

>>contour (Z,10)

>> [X,Y]=meshgrid(-1.5:0.01:1.5,-2.5:0.01:2.5);
>> Z=(exp(-(4*X.^2+2*Y.^2)).*cos(8*X))+(exp(3*(((2*X+1)./2).^2+2*Y.^2)));
>> mesh(X,Y,Z)
>> hold on
>> contour (Z, 0.001)
>> contour (Z, 0.01)

Anda mungkin juga menyukai