BÀI GIẢNG MATLAB - Trang 116

111

omega=4; Omega=10;
A=0.2; B=0.4;
delta=0.4; psi=0.4; phi=0.3;

t=[0:0.01:15];
x=A*sin(Omega*t+phi)+B*exp(-delta*t).*sin(omega*t+psi);
xp=A.*cos(Omega*t+phi)*Omega-B*delta.*exp(-
delta*t).*sin(omega*t+psi)+B.*exp(-
delta*t).*cos(omega*t+psi)*omega;
figure(1)
plot3(t, x, xp, '-k', 'LineWidth',1)
xlabel('t [s]'); ylabel('x [m]'); zlabel('xp [m/s]');
view(30,30);
box on
axis([0, t(end), min(x), max(x), min(xp), max(xp)])

0

5

10

15

-0.4

- 0.2

0

0.2

0.4

-2

0

2

x [m]

t [s]

xp

[

m

/s

]

Hình 3-49. Hiển thị đồ thị dao động trong không gian chuyển động

Vẽ đồ thị hàm hai biến:

2

2

0.2 (

)

2

2

( , )

sin(

)

x

y

z

f x y

e

x

y

+

=

=

+

x = [-3 : 0.1 : 3];
y = [-3 : 0.1 : 3];
[X, Y] = meshgrid(x,y);

f=exp(-0.2*(X.^2+Y.^2)).*sin(X.^2+Y.^2);
%hoac Z=exp(-0.2*(X.^2+Y.^2)).*sin(X.^2+Y.^2);
mxf=max(max(f)); % tim gia tri lon nhat cua ham f