Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1a)
- clear all
- clc
- t = -3*pi:0.01:3*pi;
- y = 2*cos(3*t) + 3*sin(2*t);
- plot(t, y)
- title('y=2cos(3t)+3sin(2t)')
- xlabel('t')
- ylabel('x1(t)')
- 1b)------------------------------------------------------------------------------------------------------
- clear all
- clc
- t = -pi:0.01:pi;
- subplot(2,1,1)
- y = abs(exp(1i*4*t) + exp(1i*11*t));
- plot(t, y)
- title('e^(4it)+e^(11it)')
- xlabel('t')
- ylabel('x2(t)')
- subplot(2,1,2)
- y1 =2*abs(cos((7/2)*t));
- plot(t , y1)
- title('2|cos(7/2t)|')
- xlabel('t')
- ylabel('x2(t)')
- //////////////////////////////////////
- x(t) = e^(j4t) + e^(j11t)
- x(t) = e^(j(15/2)t) * [e^(-j(7/2)t) + e^(j(7/2)t)]
- e^(-j(7/2)t) = cos((7/2)t) - jsin((7/2)t)
- e^(j(7/2)t) = cos((7/2)t) + jsin((7/2)t)
- x(t) = 2*e^(j(15/2)t) * [cos((7/2)t)]
- |x(t)| = 2|cos((7/2)t)|
- 2a)------------------------------------------------------------------------------------------------------
- clear all
- clc
- n = -20:20;
- x1 = 5*sin((1/8)*pi*n);
- stem(n, x1)
- title('5sin((1/8)pi*n)')
- xlabel('n')
- ylabel('x[n]')
- 2c)------------------------------------------------------------------------------------------------------
- m skripta clear all
- clc
- n = -20:20;
- for i=1:length(n)
- x(i) = dd1(n(i));
- end
- stem(n, x)
- title('u(n)')
- xlabel('n')
- ylabel('x2[n]')
- funkcija function y=dd1(n)
- y=0;
- if n >= 0
- y=1;
- end
- 2b)------------------------------------------------------------------------------------------------------
- clear all
- clc
- n = -20:20;
- x3 = double (n == 3) - 4*double(n == 0) + 2*double(n == 1) + double(n == -2) - 6*double(n == -4) + 5*double(n == -5);
- stem(n, x3)
- title('δ[n+3] + 2δ[n+1] -4δ[n] + δ[n-2] -6δ[n-4] + 5δ[n-5]')
- xlabel('n')
- ylabel('x[n]')
- 3a)------------------------------------------------------------------------------------------------------
- clear all
- clc
- syms t
- ezplot('2*cos(3*t) + 3*sin(2*t)', [-3*pi, 3*pi])
- title ('x = 2cos(3t) + 3sin(2t)')
- ylabel('x(t)')
- 3b)------------------------------------------------------------------------------------------------------
- clear all
- clc
- syms t
- x = t*cos(t);
- y = t*sin(t);
- ezplot(x, y, [0*pi, 20*pi])
- title('x = t*cos(t) y = t*sin(t)')
- 4a)------------------------------------------------------------------------------------------------------
- m skripta clear all
- clc
- t = -3:0.01:4;
- plot(t, x1(t), 'LineWidth', 3)
- funkcija 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
- 4b)------------------------------------------------------------------------------------------------------
- funkcija function y = x2(t)
- for i=1:length(t)
- y(i) = 0;
- 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(t(i) >= 1)
- y(i) = 1;
- end
- end
- m skripta clear all
- clc
- t = -3:0.01:4;
- plot(t, x2(t), 'LineWidth', 3)
- 4c)------------------------------------------------------------------------------------------------------
- funkcija 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
- m skripta clear all
- clc
- t = -3:0.01:4;
- plot(t, x3(t), 'LineWidth', 3)
- 5a)------------------------------------------------------------------------------------------------------
- clear all
- clc
- t = -3:0.01:4;
- parni_dio = (1/2) * [x1(t) + x1(-t)];
- neparni_dio = (1/2) * [x1(t) - x1(-t)];
- subplot(3,1,1)
- plot(t, x1(t), 'LineWidth', 3)
- title('Original')
- subplot(3,1,2)
- plot(t, parni_dio, 'Linewidth', 3)
- title('Parni dio')
- subplot(3,1,3)
- plot(t, neparni_dio, 'LineWidth', 3)
- title('Neparni dio')
- 5b)------------------------------------------------------------------------------------------------------
- clear all
- clc
- t = -3:0.01:4;
- parni_dio = (1/2) * [x2(t) + x2(-t)];
- neparni_dio = (1/2) * [x2(t) - x2(-t)];
- subplot(3,1,1)
- plot(t, x2(t), 'LineWidth', 3)
- title('Original')
- subplot(3,1,2)
- plot(t, parni_dio, 'LineWidth', 3)
- title('Parni dio')
- subplot(3,1,3)
- plot(t, neparni_dio, 'LineWidth', 3)
- title('Neparni dio')
- 5c)------------------------------------------------------------------------------------------------------
- clear all
- clc
- t = -3:0.01:4;
- parni_dio = (1/2) * (x3(t) + x3(-t));
- neparni_dio = (1/2) * (x3(t) - x3(-t));
- subplot(3,1,1)
- plot(t, x3(t), 'LineWidth', 3)
- title('Original')
- subplot(3,1,2)
- plot(t, parni_dio , 'LineWidth', 3)
- title('Parni dio')
- subplot(3,1,3)
- plot(t, neparni_dio, 'LineWidth', 3)
- title('Neparni dio')
- 6)-------------------------------------------------------------------------------------------------------
- clear all
- clc
- t = -4:0.01:10;
- obrtanje = x3(-t);
- skaliranje = x3((1/3)*t);
- pomak = x3(t - 3);
- subplot(4,1,1)
- plot(t, x3(t), 'LineWIdth', 3)
- title('Originalni signal')
- subplot(4,1,2)
- plot(t, pomak, 'LineWIdth', 3)
- title('Pomaknuti signal')
- subplot(4,1,3)
- plot(t, obrtanje, 'LineWIdth', 3)
- title('Obrnuti signal')
- subplot(4,1,4)
- plot(t, skaliranje, 'LineWIdth', 3)
- title('Skalirani signal')
- 7)-------------------------------------------------------------------------------------------------------
- clear all
- clc
- t = -4:0.01:10;
- transformirani = x2(-3*t + 2.5);
- subplot(2,1,1)
- plot(t, x2(t), 'LineWidth', 3)
- title('Originalni')
- subplot(2,1,2)
- plot(t, transformirani, 'LineWidth', 3)
- title('Transformirani')
- 8)-------------------------------------------------------------------------------------------------------
- clear all
- clc
- n = -27:25;
- x3 = double (n == 3) - 4*double(n == 0) + 2*double(n == 1) + double(n == -2) - 6*double(n == -4) + 5*double(n == -5);
- graf1 = -x3;
- graf2 = 2*x3;
- graf3 = (1/3)*x3;
- subplot(4,1,1)
- stem(n, x3)
- title('x3 = d[n+3] + 2d[n+1] -4d[n] + d[n-2] -6d[n-4] + 5d[n-5]')
- xlabel(' ')
- ylabel('x[n]')
- axis([-20 20 -6 5])
- subplot(4,1,2)
- stem(n-5, graf1)
- title('x3(-n - 5)')
- xlabel(' ')
- ylabel('x[n]')
- axis([-20 20 -5 6])
- subplot(4,1,3)
- stem(n+8, graf2)
- title('x3[2n + 8]')
- xlabel(' ')
- ylabel('x[n]')
- axis([-20 20 -12 10])
- subplot(4,1,4)
- stem(n-2, graf3)
- title('x3[1/3n - 2]')
- xlabel(' ')
- ylabel('x[n]')
- axis([-20 20 -2 1.7])
- 9)-------------------------------------------------------------------------------------------------------
- clear all
- clc
- n = 0:30;
- x = cos((2*pi*1*n)/7);
- x1 = cos((2*pi*(5/2)*n)/7);
- x2 = cos((2*pi*6*n)/7);
- x3 = cos((2*pi*8*n)/7);
- subplot(4,1,1)
- stem(n,x)
- title('cos(n2pi/7)')
- subplot(4,1,2)
- stem(n,x1)
- title('cos(5npi/7)')
- subplot(4,1,3)
- stem(n,x2)
- title('cos(12npi/7)')
- subplot(4,1,4)
- stem(n,x3)
- title('cos(16npi/7)')
- 10)------------------------------------------------------------------------------------------------------
- clear all
- clc
- t = -5:0.01:5;
- x = cos(((3*pi*t)/1)-(pi/4)).^2;
- x1 = cos(((3*pi*t)/3)-(pi/4)).^2;
- x2 = cos(((3*pi*t)/6)-(pi/4)).^2;
- subplot(3,1,1)
- plot(t,x)
- title('(cos(t*3pi/1 - pi/4))^2')
- subplot(3,1,2)
- plot(t,x1)
- title('(cos(t*3pi/3 - pi/4))^2')
- subplot(3,1,3)
- plot(t,x2)
- title('(cos(t*3pi/6 - pi/4))^2')
- 11)-------------------------------------------------------------------------------------------------------
- clear all
- clc
- n = 0:40;
- x = 2*sin((3*pi)/4*n + 1/3);
- x1= 1.5*cos(n/7 + pi/5);
- x2 = cos(pi/4*n).*cos(pi/8*n);
- x3 = 3*cos(pi/8*n) + 2*sin(pi/2*n) - 4*sin(pi/4*n);
- subplot(4,1,1)
- stem(n,x)
- title('2sin(3pi/4n + 1/3)')
- subplot(4,1,2)
- stem(n,x1)
- title('1.5cos(n/7 + pi/5)')
- subplot(4,1,3)
- stem(n,x2)
- title('cos(pi/4n)cos(pi/8n)')
- subplot(4,1,4)
- stem(n,x3)
- title('3cos(pi/8n) + 2sin(pi/2n) - 4sin(pi/4n)')
Advertisement
Add Comment
Please, Sign In to add comment