Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help regarding Nyquist Sampling

Status
Not open for further replies.

Revolutionary

Newbie level 3
Joined
Mar 14, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
fs=6e6;
t=0:1/fs:0.5;
s=2*cos(2*pi*1e6*t)+cos(2*pi*2e6*t)+3*cos(2*pi*2.5e6*t);

%%Time Domain
plot(t,s)
xlabel('Time in seconds')
ylabel('Amplitude')
title('Time Domain representation of signal')
xlim([0 0.00001])

%%Frequency Domain
nfft=1024; %%Number of fft points taken
S = abs(fftshift(fft(s,nfft)));
plotindex = (-nfft/2:nfft/2-1)*fs/nfft;
figure
plot(plotindex, S);
title('Frequency Domain Representation of Baseband Signal');
xlabel('Frequency (Hertz)');
ylabel('Magnitude (Absolute Value)');

%%Shifted signal
fs1=49.5e6;
t1=0:1/fs1:0.5;
s1=s.*cos(2*pi*20e6*t1);

%%Time Domain
figure
plot(t1,s1)
xlabel('Time in seconds')
ylabel('Amplitude')
title('Time Domain representation of Shifted signal')
xlim([0 0.00001])

%%Frequency Domain
S1 = abs(fftshift(fft(s1,nfft)));

plotindex = (-nfft/2:nfft/2-1)*fs1/nfft;
figure
plot(plotindex, S1);
title('Frequency Domain Representation of Bandpass Signal');
xlabel('Frequency (Hertz)');
ylabel('Magnitude (Absolute Value)');

I have posted the code above and the problem which has been bugging me is really silly. The matrix dimensions don't agree and so I can't translate my signal. Actually I want to move the sum of cosines from baseband to passband and at baseband the nyquist frequency is 6 MHz and once I translate it, it becomes 49.5 MHz because then the highest frequency component is 22.5 MHz. So I want someone to tell me how I can get the correct results? I know what the problem is which is occurring because of different sample rates but I just want someone to tell me how to make it right. Thanks
 

Mityan

Full Member level 5
Joined
Jul 11, 2012
Messages
281
Helped
48
Reputation
96
Reaction score
47
Trophy points
1,308
Activity points
2,835
try to use the least common multiple of both sample rates and upsample your sines according to it. So the multiplication result s1 will be correct. Then decimate to return to 49.5
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top