Lab 1 Reportappendix
Lab 1 Reportappendix
Figure 5: Plot of subplot about real part, imaginary part, phase ,and complex
amplitude of x1(t)
Figure 9: Signal plots of Part4-2
subplot(2,2,1);
plot(t, real(x1));
title('Real part of x1(t)');
xlabel('t');
ylabel('real(x1)');
subplot(2,2,3);
plot(t, imag(x1));
title('Imaginary part of x1(t)');
xlabel('t');
ylabel('imag(x1)');
subplot(2,2,2);
plot(t, abs(x1));
title('Complex amplitude of x1(t)');
xlabel('t');
ylabel('abs(x1)');
subplot(2,2,4);
plot(t, angle(x1));
title('Phase of x1(t)');
xlabel('t');
ylabel('angle(x1)');
Part4 codes:
t = 0:0.05:20;
n = 0:1:50;
signals = {
{'cos(0.4*pi*t)', @(t) cos(0.4*pi*t)}, % a) continuous-time
{'cos(0.4*pi*n)', @(n) cos(0.4*pi*n)}, % b) discrete-time
{'cos(0.4*t)', @(t) cos(0.4*t)}, % c) continuous-time
{'cos(0.4*n)', @(n) cos(0.4*n)}, % d) discrete-time
{'cos(0.4*exp(1)*t)', @(t) cos(0.4*exp(1)*t)}, % e) continuous-time
{'cos(0.4*exp(1)*n)', @(n) cos(0.4*exp(1)*n)}, % f) discrete-time
{'cos(0.2*pi*t) + sin(0.4*pi*t)', @(t) cos(0.2*pi*t) + sin(0.4*pi*t)}, % g)
continuous-time
{'cos(0.4*pi*n) + sin(0.2*pi*n)', @(n) cos(0.4*pi*n) + sin(0.2*pi*n)}, % h)
discrete-time
{'sin(0.2*pi*n) + sin(0.4*pi*n)', @(n) sin(0.2*pi*n) + sin(0.4*pi*n)}, % i)
discrete-time
{'cos(0.2*t) + cos(0.2*exp(1)*t)', @(t) cos(0.2*t) + cos(0.2*exp(1)*t)} % j)
continuous-time
};
figure;
for k = 1:length(signals)
subplot(5, 2, k);
signal = signals{k};
if contains(signal{1}, 'n') % Discrete-time signal
stem(n, signal{2}(n));
xlabel('n');
else % Continuous-time signal
plot(t, signal{2}(t));
xlabel('t');
end
ylabel('Amplitude');
title(signal{1});
end
sgtitle('Signal Plots’);
On-Lab Codes:
t=[0:1/792500:1];
xm=cos(634*pi.*t).*cos(634.*4*pi.*t);
soundsc(xm,79250);
figure;
plot(t,xm);
xlabel('t');
ylabel('xm');
grid on;