www.pudn.com > Digital_and_Analog_Communications_Systems.zip > E4_116.M


% File: E4_116.M 
 
clear; 
 
fc = 10; 
fa = 1; 
Ta = 1/fa; 
dt = 4*Ta/200; 
wc = 2*pi*fc; 
wa = 2*pi*fa; 
 
t = 0:dt:4*Ta; 
x = cos(wa*t); 
x = x(:); 
y = zeros(length(t),1); 
y = pulse(y,t,Ta,2*Ta); 
 
j = sqrt(-1); 
g = x + j*y; 
g = g(:); 
 
temp1 = cos(wc*t); 
temp2 = sin(wc*t); 
temp1 = temp1(:); 
temp2 = temp2(:); 
 
v = x.*temp1 - y.*temp2; 
 
subplot(211); 
plot(t,x,t,y,':'); 
xlabel('t'); 
title('x(t) (solid)  y(t) (dotted)'); 
 
subplot(212); 
plot(t,v,t,abs(g),':'); 
xlabel('t'); 
title('v(t) (solid)  |g(t)| (dotted)'); 
subplot(111);