Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

% generation of square wave

clc
clear all
close all

f = 100;
T = 1/f;
t = 0:T/f:T;
x = square(2*pi*f*t);

subplot(2,1,1)
plot(t,x,'r')
grid
xlabel('Time - t')
ylabel('amplitude')
title('squarewave - 21075A1008')
% axis([0 T*1 1])

subplot(2,1,2)
stem(t,x,'y')
grid
xlabel('Time - t')
ylabel('amplitude')
title('discrete squarewave - 21075A1008')
% axis([0 T*1 1])

1
Published with MATLAB® R2020a

You might also like