Reply by naim...@yahoo.com.sg July 24, 20072007-07-24
Hi,I would like to ask about my Fsk code.Why when i change my ts value to 0.05 or 0.005,i'm not able to get the correct Fsk signal?Anybody can help me?Below is what my code looks like..

echo on
t0=0.6; %signal duration
ts=0.0005; %sampling interval
fc 0; %carrier frequency
kfP; %modulation index
fs=1/ts; %sampling frequency
t=(0:ts:t0); %time vector
df=0.25; %required fequency deviation
m=[ones(1,t0/(3*ts)),-1*ones(1,t0/(3*ts)),zeros(1,t0/(3*ts)+1)]; %message signal
int_m(1)=0;
for i=1:length(t)-1%integral of m
int_m(i+1)=int_m(i)+m(i)*ts;
end
[M,m,df1]tseq(m,ts,df); %Fourier transform
M=M/fs; %scaling
f=(0:df1:df1*(length(m)-1))-fs/2; %frequency vector
u=cos(2*pi*fc*t+2*pi*kf*int_m); %modulated fsk signal
[U,u,df1]tseq(u,ts,df); %Fourier transform
U=U/fs; %scaling
pause %Press any key to see a plot of the message & fsk signal in time domain
subplot(2,1,1)
plot(t,m(1:length(t)),'g')
axis([0 0.6 -2 2])
xlabel('Time(sec)') %xlabel heading of message signal
ylabel('Amplitude') %ylabel heading of message signal
title('Message signal')
subplot(2,1,2)
plot(t,u(1:length(t)))
axis([0 0.6 -2 2])
xlabel('Time(sec)') %xlabel heading of Fsk signal
ylabel('Signal Amplitude') %ylabel heading of Fsk signal
title('Fsk signal')

Thanks.
Best regards,Naimah.