Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: GENERATION OF WAVEFORMS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
GENERATION OF WAVEFORMS

[attachment=50958]


PROGRAM:

%CONTINUOUS WAVEFORM GENERATION
%using MATLAB functions
clc;%clears all input and output from the Command Window display
clear all;%Removes all variables, functions from memory,
%leaving the workspace empty

%sinusoidal waveform
%sine wave
f=input('Enter the frequency : ');%f-frequency
a=input('Enter the desired amplitude value : ');%a-amplitude
t=-10:0.01:10;%t-time
x=a*sin(2*pi*f*t);%x-sine wave signal

%Plotting of sine wave
subplot(4,1,1);%subplot(m,n,p) creates an axes in the pth pane of a
%figure divided into an m-by-n matrix of rectangular panes
plot(t,x,'k','linewidth',1.5);%Linear 2-D plot with 'k' representing black
%colour plot with width 1.5
xlabel('t(sec)');%Label the x-axis
ylabel('x(t)');%Label the y-axis
title('SINE WAVE GENERATION');%Add title to current axes
grid on;%layout grid that can aid the hand layout of objects
%displayed in the figure

%cosine wave
y=a*cos(2*pi*f*t);%y-cosine wave signal

%Plotting of cosine wave
subplot(4,1,2);
plot(t,y,'k','linewidth',1.5);
xlabel('t(sec)');
ylabel('y(t)');
title('COSINE WAVE GENERATION');
grid on;

%square wave
z=a*square(2*pi*f*t);%z-square wave signal

%Plotting of square wave
subplot(4,1,3);
plot(t,z,'k','linewidth',1.5);
xlabel('t(sec)');
ylabel('z(t)');
title('SQUARE WAVE GENERATION');
grid on;

%sawtooth wave
w=sawtooth(2*pi*f*t);%w-sawtooth wave signal

%Plotting of sawtooth wave
subplot(4,1,4);
plot(t,w,'k','linewidth',1.5);
xlabel('t(sec)');
ylabel('w(t)');
title('SAWTOOTH WAVE GENERATION');
grid on;


INPUT:

Enter the frequency : 0.75
Enter the desired amplitude value : 1