0% found this document useful (0 votes)
5 views4 pages

MSK Signal

The document contains MATLAB code that generates and plots various signals over a time vector from 0 to 9 seconds. It includes multiple subplots displaying different waveforms, including step functions, sine and cosine functions, and a modulated signal. The graphs are formatted with titles, axis labels, and grid lines for clarity.

Uploaded by

Sumanth Badugu
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)
5 views4 pages

MSK Signal

The document contains MATLAB code that generates and plots various signals over a time vector from 0 to 9 seconds. It includes multiple subplots displaying different waveforms, including step functions, sine and cosine functions, and a modulated signal. The graphs are formatted with titles, axis labels, and grid lines for clarity.

Uploaded by

Sumanth Badugu
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/ 4

MATLAB Command Window Page 1

>> % Define time vector


t = 0:0.01:9;

figure;

% Graph 1
subplot(3, 3, 1);
y1 = zeros(size(t));
y1(t >= 0 & t < 1) = 1;
y1(t >= 1 & t < 2) = 1;
y1(t >= 2 & t < 3) = -1;
y1(t >= 3 & t < 4) = -1;
y1(t >= 4 & t < 5) = -1;
y1(t >= 5 & t < 6) = 1;
y1(t >= 6 & t < 7) = 1;
y1(t >= 7 & t < 8) = 1;
y1(t >= 8 & t <= 9) = 0;
plot(t, y1, 'k', 'LineWidth', 2);
title('b(t)');
xlabel('Time (t)');
ylabel('b(t)');
grid on;
ylim([-2, 2]);
xticks(0:1:9);
yticks(-2:1:2);

% Graph 2
subplot(3, 3, 2);
y2 = zeros(size(t));
y2(t >= 0 & t < 1) = 1;
y2(t >= 1 & t < 2) = 1;
y2(t >= 2 & t < 3) = -1;
y2(t >= 3 & t < 4) = -1;
y2(t >= 4 & t < 5) = -1;
y2(t >= 5 & t < 6) = -1;
y2(t >= 6 & t < 7) = 1;
y2(t >= 7 & t < 8) = 1;
plot(t, y2, 'r', 'LineWidth', 2);
title('bo(t)');
xlabel('Time (t)');
ylabel('bo(t)');
grid on;
ylim([-2, 2]);
xticks(0:1:9);
yticks(-2:1:2);

% Graph 3
subplot(3, 3, 3);
y3 = zeros(size(t));
MATLAB Command Window Page 2

y3(t >= 0 & t < 1) = 0;


y3(t >= 1 & t < 2) = 1;
y3(t >= 2 & t < 3) = 1;
y3(t >= 3 & t < 4) = -1;
y3(t >= 4 & t < 5) = -1;
y3(t >= 5 & t < 6) = 1;
y3(t >= 6 & t < 7) = 1;
y3(t >= 7 & t < 8) = 1;
y3(t >= 8 & t <= 9) = 1;
plot(t, y3, 'b', 'LineWidth', 2);
title('be(t)');
xlabel('Time (t)');
ylabel('be(t)');
grid on;
ylim([-2, 2]);
xticks(0:1:9);
yticks(-2:1:2);

% Graph 4
subplot(3, 3, 4);
y4_1 = zeros(size(t));
y4_2 = zeros(size(t));

% Set values for different time intervals using sine and cosine curves
y4_1(t >= 1 & t < 2) = sin(2 * pi * (t(t >= 1 & t < 2) - 1) / 4);
y4_2(t >= 1 & t < 2) = cos(2 * pi * (t(t >= 1 & t < 2) - 1) / 4);

y4_1(t >= 2 & t < 3) = sin(2 * pi * (3 - t(t >= 2 & t < 3)) / 4);
y4_2(t >= 2 & t < 3) = -cos(2 * pi * (3 - t(t >= 2 & t < 3)) / 4);

y4_1(t >= 3 & t < 4) = -sin(2 * pi * (t(t >= 3 & t < 4) - 3) / 4);
y4_2(t >= 3 & t < 4) = -cos(2 * pi * (t(t >= 3 & t < 4) - 3) / 4);

y4_1(t >= 4 & t < 5) = -sin(2 * pi * (5 - t(t >= 4 & t < 5)) / 4);
y4_2(t >= 4 & t < 5) = cos(2 * pi * (5 - t(t >= 4 & t < 5)) / 4);

y4_1(t >= 5 & t < 6) = sin(2 * pi * (t(t >= 5 & t < 6) - 5) / 4);
y4_2(t >= 5 & t < 6) = cos(2 * pi * (t(t >= 5 & t < 6) - 5) / 4);

y4_1(t >= 6 & t < 7) = sin(2 * pi * (7 - t(t >= 6 & t < 7)) / 4);
y4_2(t >= 6 & t < 7) = -cos(2 * pi * (7 - t(t >= 6 & t < 7)) / 4);

y4_1(t >= 7 & t < 8) = -sin(2 * pi * (t(t >= 7 & t < 8) - 7) / 4);
y4_2(t >= 7 & t < 8) = -cos(2 * pi * (t(t >= 7 & t < 8) - 7) / 4);

y4_1(t >= 8 & t <= 9) = -sin(2 * pi * (9 - t(t >= 8 & t <= 9)) / 4);
y4_2(t >= 8 & t <= 9) = cos(2 * pi * (9 - t(t >= 8 & t <= 9)) / 4);

% Plot the signals


MATLAB Command Window Page 3

plot(t, y4_1, 'b', 'LineWidth', 2);


hold on;
plot(t, y4_2, 'r', 'LineWidth', 2);
plot([0, 1], [0, 0], 'k--'); % To ensure y=0 at t=0
hold off;
title('Signal 4');
xlabel('Time (t)');
ylabel('y');
legend('Sin(2πt/4T) (Red)', 'Cos(2πt/4T) (Blue)');
grid on;
ylim([-2, 2]);
xticks(0:1:9);
yticks(-2:1:2);

% Graph 5
subplot(3, 3, 5);
y5 = y3 .* -cos(2 * pi * t / 4);
plot(t, y5, 'b', 'LineWidth', 2);
title('be(t) * Sin(2πt/4T)');
xlabel('Time (t)');
ylabel('be(t) * Sin(2πt/4T)');
grid on;
ylim([-2, 2]);
xticks(0:1:9);
yticks(-2:1:2);

% Graph 6
subplot(3, 3, 6);
y6 = y2 .* sin(2 * pi * t / 4);
y6(t < 1) = 0; % Ensure y=0 at t=0
plot(t, y6, 'r', 'LineWidth', 2);
title('bo(t) * Cos(2πt/4T)');
xlabel('Time (t)');
ylabel('bo(t) * Cos(2πt/4T)');
grid on;
ylim([-2, 2]);
xticks(0:1:9);
yticks(-2:1:2);

% Graph 7 & 8
subplot(3, 3, 7);
y7 = -sin(2 * 6 * pi * t / 4);
y7(t < 1) = 0;
plot(t, y7, 'b', 'LineWidth', 2);
title('fH = 1.5 fb');
xlabel('Time (t)');
ylabel('fH = 1.5 fb');
grid on;
ylim([-2, 2]);
MATLAB Command Window Page 4

xticks(0:1:9);
yticks(-2:1:2);

subplot(3, 3, 8);
y8 = sin(2 * 4 * pi * t / 4);
y8(t < 1) = 0;
plot(t, y8, 'b', 'LineWidth', 2);
title('fL = 1 fb');
xlabel('Time (t)');
ylabel('fL = 1 fb');
grid on;
ylim([-2, 2]);
xticks(0:1:9);
yticks(-2:1:2);

% Graph 9
subplot(3, 3, 9);
y9 = zeros(size(t));
y9(t >= 1 & t < 2) = y7(t >= 1 & t < 2);
y9(t >= 2 & t < 3) = -y8(t >= 2 & t < 3);
y9(t >= 3 & t < 4) = -y7(t >= 3 & t < 4);
y9(t >= 4 & t < 5) = -y7(t >= 4 & t < 5);
y9(t >= 5 & t < 6) = -y8(t >= 5 & t < 6);
y9(t >= 6 & t < 7) = y7(t >= 6 & t < 7);
y9(t >= 7 & t < 8) = y7(t >= 7 & t < 8);
plot(t, y9, 'k', 'LineWidth', 2);
title('MSK Signal');
xlabel('Time (t)');
ylabel('MSK');
grid on;
ylim([-2, 2]);
xticks(0:1:9);
yticks(-2:1:2);
>>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy