electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Spread spectrum: matlab debug


Post new topic  Reply to topic    EDAboard.com Forum Index -> Analog Circuit Design -> Spread spectrum: matlab debug
Author Message
hmsheng



Joined: 17 Dec 2003
Posts: 212
Helped: 16
Location: China


Post18 Jul 2007 16:00   

matlab spread spectrum


Hi, friends, I write a matlab program to simulate the spread spectrum result. fft is used to view the spectrum of the modulated signal. The spectrum should be same with differenct sample points. In the matlab program, tstep and tstop will dicide the sample points. tstep=1e-9. When tstop changed the width of the spectrum will change too! So, there must be some problem in my program. Please help to find the problem. Thanks a lot.
Please change the tstop=1e-4 to tstop=2e-4 and compare the spectrum.


clear;

Nfft = 2^18; % fft points

% Create a 100MHz signal source
A = 1; % Amplitude of the signal
fc = 100e6; % Carrier frequency
tstep = 1e-9; fs = 1/tstep;
tstop = 1e-4;
t = 0:tstep:tstop-tstep;

vt = A*cos(2*pi*fc*t); % single tone signal source
Y = fft(vt,Nfft);
Pydb = 10*log10(Y.*conj(Y)/Nfft);


% Spread spectrum
Fspread = 30e3; Tspread = 1/Fspread;
Fd = fc*0.0025; % Frequency deviation
Fcss =fc+2*abs(mod(t+Tspread/4,Tspread)/Tspread*2*Fd-Fd)-Fd;

vtss = A*cos(2*pi*Fcss.*t); % Spread signal
Yss = fft(vtss,Nfft);
Pyssdb = 10*log10(Yss.*conj(Yss)/Nfft);

f = fs*(0:Nfft-1)/Nfft;

subplot(2,1,1), plot(f,Pydb,f,Pyssdb);
axis([9e7,11e7,-100,50]), grid;
xlabel('Frequecy (Hz)'), ylabel('Power (dB)');

subplot(2,1,2), plot(t,Fcss);
xlabel('Time (s)'), ylabel('Frequency (Hz)');
grid;
Back to top
Google
AdSense
Google Adsense




Post18 Jul 2007 16:00   

Ads




Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Analog Circuit Design -> Spread spectrum: matlab debug
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Which spectrum need to be spread in DSS spread spectrum (2)
spread spectrum (9)
Spread Spectrum Communications (3)
Spread spectrum question (3)
Antijamming in Spread Spectrum (1)
Spread spectrum module (7)
Spread Spectrum PLL (2)
spread spectrum communications (1)
spread spectrum technology (1)
Spread Spectrum Techniques (3)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS