santosh_vjit
Newbie level 4
int_m(i+1)=int_m(i)+m(i)*ts
hi to all ..............
im doing my project in frequency demodualtion using pll our project has been strucked as we are not able to correct the error in this program we r getting frequency modulated wave same as carrier wave i request u all to solve my program i will be thankful if u provide any other example i would be workin on it.................
% Signal generation
t0 = .15; % signal duration
ts = 0.0005; % sampling interval
fc = 200; % carrier frequency
kf = 50; % modulation index
fs = 1/ts; % sampling frequency
t = [0:ts:t0]; % time vector
df = 0.25; % required frequency resolution
c = cos(2*pi*fc*t); % carrier signal
m = [2*ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)];
% Frequency modulation
int_m(1) = 0;
for (i = 1 : length(t)-1) % integral of m
int_m(i+1) = int_m(i) + m(i)*ts;
end
u = cos(2*pi*fc*t + 2*pi*kf*int_m); % modulated signal
figure
subplot (3,1,1)
plot (m(1:300))
TITLE ('Modulating Signal')
grid on;
subplot (3,1,2)
plot (c(1:300))
TITLE ('Carrier Signal')
grid on;
subplot (3,1,3)
plot (u(1:300))
TITLE ('Frequency Modulated Signal')
grid on;
% Frequency demodulation
t = [0:ts:ts*(length(u)-1)]; % finding phase of modulated signal
x = hilbert(u);
z = x.*exp(-j*2*pi*250*t);
phi = angle(z);
phi = unwrap(phi); % restoring original phase
dem = (1/(2*pi*kf))*(diff(phi)/ts); % demodulated signal
figure
subplot (3,1,1)
plot (c(1:300))
TITLE ('Carrier Signal')
grid on;
subplot (3,1,2)
plot (u(1:300))
TITLE ('Frequency Modulated Signal')
grid on;
subplot (3,1,3)
dem = smooth(dem,7) + 1;
plot (dem(1:300))
axis ([0 300 -2 2]);
TITLE ('De-Modulated Signal')
grid on;
end
hi to all ..............
im doing my project in frequency demodualtion using pll our project has been strucked as we are not able to correct the error in this program we r getting frequency modulated wave same as carrier wave i request u all to solve my program i will be thankful if u provide any other example i would be workin on it.................
% Signal generation
t0 = .15; % signal duration
ts = 0.0005; % sampling interval
fc = 200; % carrier frequency
kf = 50; % modulation index
fs = 1/ts; % sampling frequency
t = [0:ts:t0]; % time vector
df = 0.25; % required frequency resolution
c = cos(2*pi*fc*t); % carrier signal
m = [2*ones(1,t0/(3*ts)),-2*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)];
% Frequency modulation
int_m(1) = 0;
for (i = 1 : length(t)-1) % integral of m
int_m(i+1) = int_m(i) + m(i)*ts;
end
u = cos(2*pi*fc*t + 2*pi*kf*int_m); % modulated signal
figure
subplot (3,1,1)
plot (m(1:300))
TITLE ('Modulating Signal')
grid on;
subplot (3,1,2)
plot (c(1:300))
TITLE ('Carrier Signal')
grid on;
subplot (3,1,3)
plot (u(1:300))
TITLE ('Frequency Modulated Signal')
grid on;
% Frequency demodulation
t = [0:ts:ts*(length(u)-1)]; % finding phase of modulated signal
x = hilbert(u);
z = x.*exp(-j*2*pi*250*t);
phi = angle(z);
phi = unwrap(phi); % restoring original phase
dem = (1/(2*pi*kf))*(diff(phi)/ts); % demodulated signal
figure
subplot (3,1,1)
plot (c(1:300))
TITLE ('Carrier Signal')
grid on;
subplot (3,1,2)
plot (u(1:300))
TITLE ('Frequency Modulated Signal')
grid on;
subplot (3,1,3)
dem = smooth(dem,7) + 1;
plot (dem(1:300))
axis ([0 300 -2 2]);
TITLE ('De-Modulated Signal')
grid on;
end