0% found this document useful (0 votes)
18 views7 pages

Lab 1 Reportappendix

The document contains various plots and code snippets related to signal processing, including stem plots for discrete signals and plots for continuous signals. It includes MATLAB code for generating and visualizing different types of signals, both continuous and discrete, as well as their real, imaginary, and phase components. Additionally, it features sound generation from a cosine-modulated signal and visualizations of the resulting waveform.

Uploaded by

yaren baştuğ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views7 pages

Lab 1 Reportappendix

The document contains various plots and code snippets related to signal processing, including stem plots for discrete signals and plots for continuous signals. It includes MATLAB code for generating and visualizing different types of signals, both continuous and discrete, as well as their real, imaginary, and phase components. Additionally, it features sound generation from a cosine-modulated signal and visualizations of the resulting waveform.

Uploaded by

yaren baştuğ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Figure 1: Stem Plot of xd1[n]

Figure 2: Stem Plot of xd2[n]


Figure 3: Stem Plot of xd1[n] and xd2[n]

Figure 4:Stem Plot of xb1[n]


Figure 5: Plot of xc1(t)

Figure 6: Plot of xc2(t)


Figure 7: Plot of xa(t)

Figure 5: Plot of subplot about real part, imaginary part, phase ,and complex
amplitude of x1(t)
Figure 9: Signal plots of Part4-2

Figure 10: xm(t)


Part 3 codes:
w1 = 2*pi*440;
w2 = 2*pi*880;
t = [0:1/44000:0.01];
x1 = exp(1i *w1 * t) + exp(1i *w2 * t);
figure;

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;

You might also like