Waveform Generation
Waveform Generation
Waveform Generation
USING MATLAB
Sine, Cosine, Square and Triangular
waveforms
generation and plotting
WAVE GENERATION
The waveform can be gerated using
hardware( OPAmps configuration) or using MATLAB
software.
Lab session entails using MATLAB, to generate four
waveforms and do subplots having row(s) and
column(s).
Defining the type of signal and inputting the data
Formula : Atype(2*pi*F*t)
A= Amplitue
Type = Sine/ Cosine/Square/sawtooth
EXPECTED FINAL RESULT
SINE WAVE
%Sine Waveform
A=input(‘Enter Amplitude’);
F=input(‘Enter Frequency’);
Q=input(‘Enter Phase’);
t=0: 0.01:1;
y_s=A*sin(2*pi*F*t+Q);
plot(t, y_s);
xlabel('Time');
ylabel(‘Amplitude');
title(‘Sine Waveform');
SINE WAVEFORM
A=1,F=2, Q=0
OTHER WAVEFORMS
%Others waveforms by editing functions.
1. Sine wave with phase shift of 30 degrees
(Q=pi/6) phase lag and 60 degrees phase
lead.
2. Cosine wave using cos and sine function with
phase shift
3. Square wave using square function.
4. Triangular wave using sawtooth function and
duty cycle of 0.5.
COSINE WAVEFORM
SQUARE WAVEFORM
TRIANGULAR WAVEFORM
SUBPLOTS
%All the waveform
Combine all the four waveform into one code
Apply subplot function to plot
1. 2 rows and two columns
2. 1 row and 4 columns
3. 4 rows and 1 column
SUB PLOT1
2 ROWS 2 COLUMNS
SUB PLOT1
1 ROW 4 COLUMNS
SUB PLOT1
4 ROWS 1 COLUMN
SUBPLOTS
%All the waveform
1. 2 rows and two columns
2. 1 row and 4 columns
3. 4 rows and 1 column
Which plot option gives best waveform
presentation?
WHICH ONE?