MATLAB Code for generating Square Wave

%Program to generate a continuous time square wave %
%%%%%%%%%%%%% Start %%%%%%%%%%%%%%
clc
close all;
clear all;
a=input('Enter the amplitude of the square wave A = ');
f= input('Enter the frequency of the square wave F = ');
dc=input('Enter the duty cycle of the wave DC = ');
f=f*2*pi;
t=0:.001:1;
y=a*square(f*t,dc);

plot(t,y);
axis([0 1 -3 3]);
title('Generation of Square Wave')

% For generating Square wave following value can be taken


%Enter the amplitude of the square wave A = 2
%Enter the frequency of the square wave F = 10
%Enter the duty cycle of the wave DC = 50

Contact:  
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Contact Us

Name

Email *

Message *

Blog Archive

Blog Archive

Popular posts