0% found this document useful (0 votes)
13 views

Pre Lab

This document contains MATLAB code that generates and plots different sine wave signals. It contains 3 sections: 1) Plots a single 50Hz sine wave, 2) Plots two sine waves of different frequencies (50Hz and 25Hz) on the same graph, 3) Plots three sine waves that are 120 degrees out of phase from each other.

Uploaded by

NumanAbdullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Pre Lab

This document contains MATLAB code that generates and plots different sine wave signals. It contains 3 sections: 1) Plots a single 50Hz sine wave, 2) Plots two sine waves of different frequencies (50Hz and 25Hz) on the same graph, 3) Plots three sine waves that are 120 degrees out of phase from each other.

Uploaded by

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

Pre_lab

clc
clear all
close all
%Question 1
t = 0:0.0005:0.04;
amp = 3;
freq_HZ = 50;
freq_RPS = 2*pi*freq_HZ;
y1 = amp * sin(freq_RPS * t);
plot(t,y1)
grid
xlabel('Time (seconds)')
ylabel('y(t)')
title('SINE wave of 50HZ')
%Question 2
figure
t = 0:0.0005:0.04;
amp = 3;
freq_HZ = 50;
freq_RPS = 2*pi*freq_HZ;
y1 = amp * sin(freq_RPS * t);
plot(t,y1)
hold on
freq_HZ = 25;
freq_RPS = 2*pi*freq_HZ;
y2 = amp * sin(freq_RPS * t);
plot(t,y2)
xlabel('Time (seconds)')
ylabel('y(t)')
title('SINE wave of 25HZ and 50HZ')
legend('50 Hz','25 Hz')
grid
%Question 3
figure
t = 0:0.0005:0.04;
amp = 3;
freq_HZ = 25;
freq_RPS = 2*pi*freq_HZ;
y1 = amp * sin(freq_RPS * t);
y2 = amp * sin(freq_RPS * t + (2*pi)/3);
y3 = amp * sin(freq_RPS * t + (4*pi)/3);
plot(t,y1,'r',t,y2,'m',t,y3,'k')
xlabel('Time (seconds)')
ylabel('y(t)')
title('sine waves out of phase of 120
angle')
legend('0 angle','120 angle','240 angle')
grid

You might also like