You are on page 1of 20

1)

t1=-(3*pi):0.1:(3*pi);
x1=2*cos(3*t1)+3*sin(2*t1);
subplot(2,1,1);
plot(t1,x1)
xlabel('t')
ylabel('x(t)')
t2=-pi:0.1:pi;
x2=abs(exp(4j*t2)+exp(11j*t2));
subplot(2,1,2);
plot(t2,x2);
xlabel('t')
ylabel('x(t)')
2)

a)
n=-20:0.5:20;
xa=5*sin((1/8)*pi*n);
stem(n,xa);
b)
n=[-10:10];
stem(n,x2_zad2(n))

function y=x2_zad2(n)
for i=1:length(n)
y(i)=0;
if(n(i)>=0)&(floor(n(i))==n(i))
y(i)=1;
end
end
c)
n=[-5:8];
xc=x3_zad2(n + 3) + 2*x3_zad2(n + 1) - 4*x3_zad2(n) + x3_zad2(n -2) - 6*x3_zad2(n
-4) + 5*x3_zad2(n - 5);
stem(n,xc);

function y=x3_zad2(n)
for i=1:length(n)
y(i)=0;
if(n(i)==0)&(floor(n(i))== n(i))
y(i)=1;
end
end
3)

a)
syms t
a=-3*pi;
b=3*pi;
ezplot(2*cos(3*t)+3*sin(2*t),[a,b]);
b)
syms t
a=0;
b=10*pi;
ezplot(t*cos(t),[a,b])
syms t
a=0;
b=10*pi;
ezplot(t*sin(t),[a,b])

4)

a)
t = -3:0.01:4
plot(t, x1(t))

function y=x1(t)
for i=1: length(t)
y(i)=0;

if (0<=t(i)) & (t(i)<1)


y(i)=t(i)
end

if (1<=t(i)) & (t(i)<2)


y(i)=-t(i)+2
end
end
b)
t = -3:0.01:4
plot(t, x2(t))

function y=x2(t)
for i=1: length(t)

if (-2>=t(i))
y(i)=0
end

if (-2<=t(i)) & (t(i)<-1)


y(i)=t(i)+2
end

if(-1<=t(i)) & (t(i)<0)


y(i)=-t(i)
end

if(0<=t(i)) & (t(i)<1)


y(i)=t(i)
end

if(1<=t(i))
y(i)=1
end
end
end
c)
t = -3:0.01:4
plot(t, x3(t))

function y=x3(t)
for i=1: length(t)
y(i)=0

if(0<=t(i)) & (t(i)<1.5)


y(i)=1
end

if(1.5<=t(i)) & (t(i)<2)


y(i)=-0.5
end

end
end
5)

a)
t = -3:0.01:4;
subplot(3,1,1)
plot(t, x1(t))
subplot(3,1,2)
plot(t, x1(-t))
subplot(3,1,3)
plot(t, -x1(t))
b)
t = -3:0.01:4;
subplot(3,1,1)
plot(t, x2(t))
subplot(3,1,2)
plot(t, x2(-t))
subplot(3,1,3)
plot(t, -x2(t))
c)
t = -3:0.01:4;
subplot(3,1,1)
plot(t, x3(t))
subplot(3,1,2)
plot(t, x3(-t))
subplot(3,1,3)
plot(t, -x3(t))
6)
t = -7:0.01:7;
subplot(4,1,1)
plot(t, x3(t))
title('originalni signal')
subplot(4,1,2)
plot(t,x3(t-3))
title('pomak')
subplot(4,1,3)
plot(t,x3(-t))
title('obrtanje')
subplot(4,1,4)
plot(t,x3(1/3*t))
title('skaliranje')
7)
t = -4:0.01:4;
subplot(2,1,1)
plot(t,x2(t))
title('originalni signal')
subplot(2,1,2)
plot(t,x2(-3*t+2.5))
title('signal s transformiranom vremenskom varijablom')
8)
n=[-20:20];
subplot(4,1,1)
stem(n,x2_zad2(n))
subplot(4,1,2)
stem (n,x2_zad2(-n-5))
subplot(4,1,3)
stem(n,x2_zad2(2*n+8))
subplot(4,1,4)
stem(n,x2_zad2(1/3*n-2))
9)
n=[0:30];
m=1;
x=cos((2*pi*m/7)*n);
plot(n,x,'r')
hold on
m=5/2;
x=cos((2*pi*m/7)*n);
plot(n,x,'g')
m=6;
x=cos((2*pi*m/7)*n);
plot(n,x,'b')
m=8;
x=cos((2*pi*m/7)*n);
plot(n,x,'y')
Signali su jednaki tamo gdje je m = 1 , m=6 ili m=8

10)
t=0:0.01:pi;
k=1;
subplot(3,1,1)
x=(1+cos(2*((3*pi/k)*t-(pi/4)))/2);
plot(t,x)
subplot(3,1,2)
k=3;
x=(1+cos(2*((3*pi/k)*t-(pi/4)))/2);
plot(t,x)
subplot(3,1,3)
k=6;
x=(1+cos(2*((3*pi/k)*t-(pi/4)))/2);
plot(t,x)
11)
n=[0:40];
x1=2*sin(3*pi/4*n+1/3);
x2=1.5*cos(n/7+pi/5);
x3=3*cos(pi/8*n)+2*sin(pi/2*n)-4*sin(pi/4*n);
subplot(3,1,1)
stem(n,x1)
subplot(3,1,2)
stem(n,x2)
subplot(3,1,3)
stem(n,x3)

You might also like