You are on page 1of 4

Sinc function

Lab#02 task1

x=-20:0.01:20
y=sin(x)./x
plot(x,y)
xlabel('x')
ylabel('sin(x)/x')

cosine function

x=-20:0.01:20
f=0.3
y=cos(2*pi*f*x)
plot(x,y)
xlabel('x')
ylabel('cos(2*pi*f*x)')

sine function

x=-20:0.01:20
f=0.3
y=sin(2*pi*f*x)
plot(x,y,'-')
xlabel('x')
ylabel('sin(2*pi*f*x)')

Task 2

x=1:100;
y=log(x)
z=sqrt(x)
plot(x,y,'r')

hold on
plot(x,z,'g')
xlabel('time')
ylabel('amplitude')
hold off
for texture
plot(x,y,'r+')

plot(x,z,'g*')
task 3

Subploting command

x=linspace (0,2*pi,50)
y=sin(x)
z=cos(x)
w=tan(x)
subplot 221
plot(x,y)
subplot 222
plot(x,z)
subplot 223
plot(x,w)

data = [ 5.1000 3.5000 1.4000


4.9000 3.0000 1.4000
4.7000 3.2000 1.3000
4.6000 3.6000 1.5000
5.0000 3.9000 1.4000
5.4000 3.4000 1.7000
4.6000 3.4000 1.4000
5.0000 3.4000 1.5000]
plot3(data(:,1),data(:,2),data(:,3))
[x,y]=meshgrid(-8:0.5:8)
r=sqrt(x.^2+y.^2)+eps
z=sin(r)./r
surf(x,y,z)

You might also like