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

Experiment No 1b

The document describes an experiment to generate and plot continuous and discrete sine, square, and sawtooth waveforms using Matlab. It uses functions like sin, square, and sawtooth to generate the waveforms. The continuous waveforms are plotted using plot while the discrete waveforms are plotted using stem. The experiment demonstrates time scaling and amplification of the waveforms. It concludes that time scaling, amplification, and frequency changes can alter the generated signals, and the interval distribution and time spacing must be appropriately set.

Uploaded by

Sourav
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)
23 views

Experiment No 1b

The document describes an experiment to generate and plot continuous and discrete sine, square, and sawtooth waveforms using Matlab. It uses functions like sin, square, and sawtooth to generate the waveforms. The continuous waveforms are plotted using plot while the discrete waveforms are plotted using stem. The experiment demonstrates time scaling and amplification of the waveforms. It concludes that time scaling, amplification, and frequency changes can alter the generated signals, and the interval distribution and time spacing must be appropriately set.

Uploaded by

Sourav
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/ 3

EXPERIMENT NO.

– 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 :-

 sin(2*pi*f*t) :- It generates sine waveform with time period 1/f.


 square(t) :- It generates square waveform with time period 2π for the elements of time vector t.
 sawtooth(t) :- It generates sawtooth waveform with time period 2π for the elements of time vector t.
 stem(_,_) :- It provides graphical representation of data in discrete manner.
 axis([a b c d]) :- It sets the limit for current axes. The four element vector a,b,c,d specifies minimum and
maximum for x and y axis respectively.
 plot (a,b) :- For graphical representation of data with ‘a’ belonging to x axis and ‘b’ belonging to y axis.
 subplot (l,m,n) :- Used for compiling more than one plot where l,m,n represents total number of rows,
columns and figure position for the divided grid.

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 :-

a) To generate continuous waveforms

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')

b) To generate discrete waveforms

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 :-

a) Generated continuous sine, square and sawtooth waveforms.

Figure 2(a)

b) Generated discrete sine, square and sawtooth waveforms.

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.

You might also like