Professional Documents
Culture Documents
(EEE2006)
Lab Assessmet-1
MATLAB CODE
clc
clear all
close all
A = 10; % Amplitude
F = 3; % Frequency
t = 0:0.001:1;
y1 = A*sin(2*pi*F*t);
subplot(4,1,1)
plot(t,y1)
title('sine wave')
y2 = A*square(2*pi*F*t);
subplot(4,1,2)
plot(t,y2)
title('square wave')
y3 = A*sawtooth(2*pi*F*t);
subplot(4,1,3)
plot(t,y3)
title('sawtooth wave')
y4 = A*sawtooth(2*pi*F*t,0.5);
subplot(4,1,4)
plot(t,y4)
title('Triangular wave')
GRAPH
1) Sine signal
clc
clear all
close all
A = 10; % Amplitude
F = 3; % Frequency
t = 0:0.001:1;
y = A*sin(2*pi*F*t);
plot(t,y)
title('sine wave')
xlabel('Time(sec)')
ylabel('Amplitude')
grid on
GRAPH
2)Square signal
Clc
clear all
close all
A = 10; % Amplitude
F = 3; % Frequency
t = 0:0.001:1;
y = A*square(2*pi*F*t);
plot(t,y)
title('square wave')
xlabel('Time(sec)')
ylabel('Amplitude')
grid on
3)Sawtooth signal
clc
clear all
close all
A = 10; % Amplitude
F = 3; % Frequency
t = 0:0.001:1;
y = A*sawtooth(2*pi*F*t);
plot(t,y)
title('sawtooth wave')
xlabel('Time(sec)')
ylabel('Amplitude')
grid on
GRAPH
4)Triangular signal
Clc
clear all
close all
A = 10; % Amplitude
F = 3; % Frequency
t = 0:0.001:1;
y = A*sawtooth(2*pi*F*t,0.5);
plot(t,y)
title('sine wave')
xlabel('Time(sec)')
ylabel('Amplitude')
grid on
OUTPUT/GRAPH
RESULT
Thus, the generation of signals was performed using MATLAB and
the waveforms were plotted.