clear all
close all
clf
fb=1000 %baseband signal freqquency in hetz
tb=1/fb
fs=40000
ns=fs/fb %number of samples in one period of the base band signal
t=linspace(0,.002,ns)
sq=(1+square(t))/2
asb=5*sin(2*pi*fb*t).*sq
subplot(211)
stem(t,sq)
axis([0 .002 0 1])
xlabel('time in seconds')
ylabel('amplitude in volts')
title('square wave output')
subplot(212)
stem(t,asb)
axis([0 .002 -5 5])
xlabel('time in seconds')
ylabel('amplitude in volts')
title('simulation of samplig process')
close all
clf
fb=1000 %baseband signal freqquency in hetz
tb=1/fb
fs=40000
ns=fs/fb %number of samples in one period of the base band signal
t=linspace(0,.002,ns)
sq=(1+square(t))/2
asb=5*sin(2*pi*fb*t).*sq
subplot(211)
stem(t,sq)
axis([0 .002 0 1])
xlabel('time in seconds')
ylabel('amplitude in volts')
title('square wave output')
subplot(212)
stem(t,asb)
axis([0 .002 -5 5])
xlabel('time in seconds')
ylabel('amplitude in volts')
title('simulation of samplig process')
No comments:
Post a Comment