Experiment No 1b
Experiment No 1b
– 1(b)
AIM :-
(a) To generate continuous sine waveform, square waveform and sawtooth waveform.
(b) To generate discrete sine waveform, square waveform and sawtooth waveform.
SOFTWARE USED :-
Matlab R2016a
FUNCTIONS USED :-
THEORY:-
The sine function generates sine wave with a period of 1/f where ‘f’ is specified frequency.
The sawtooth function generates a sawtooth wave with peaks at +/- ‘A’ and a period of 2π . An optional width
parameter specifies a fractional multiple of 2π at which the signal's maximum occurs.
The square function generates a square wave with a period of 2π . An optional parameter specifies duty cycle, the
percent of the period for which the signal is positive.
Waveforms generated can be amplified or attenuated by multiplying the function by a scalar element. Time
scaling is a technique which alters the timeperiod of the signal thus expanding or contracting the same.
MATLAB CODE :-
clc
clear all
close all
t = 0:0.01:10
f = 3
a = 3*sin(2*pi*f*t)
b = 5*square(3*t);
c = 4*sawtooth(3*t);
figure(1);
subplot(311);
plot(t,a);
title ('Sine waveform');
xlabel ('Time(continuous)')
ylabel ('Amplitude')
axis ([0 3 -6 6]);
subplot(312);
plot(t,b);
axis ([0 8 -7 7]);
title ('Square waveform');
xlabel ('Time(continuous)')
ylabel ('Amplitude')
subplot(313);
plot(t,c);
axis ([0 8 -5 5]);
title ('Sawtooth waveform');
xlabel ('Time(continuous)')
ylabel ('Amplitude')
n = 0:0.05:10
f = 2
a = 3*sin(2*pi*f*n)
b = 5*square(5*n);
c = 4*sawtooth(3*n);
figure(1);
subplot(311);
stem(n,a);
title ('Sine waveform');
xlabel ('Time(discrete)')
ylabel ('Amplitude')
axis ([0 3 -6 6]);
subplot(312);
stem(n,b);
axis ([0 8 -7 7]);
title ('Square waveform');
xlabel ('Time(discrete)')
ylabel ('Amplitude')
subplot(313);
stem(n,c);
axis ([0 8 -5 5]);
title ('Sawtooth waveform');
xlabel ('Time(discrete)')
ylabel ('Amplitude')
OUTPUT :-
Figure 2(a)
Figure 2(b)
CONCLUSIONS :-
The process of time scaling and amplification is applied and observed along with the frequency change
in the generated signals.
The interval distribution for the continuous signal generation should be low to obtain optimum
waveforms.
The time spacing for discrete signal generation should be observed for the functional values to be
differentiable.