Tricky frequency spacing loop
3 views (last 30 days)
Show older comments
I have a tricky loop, well I think its quite tricky... maybe its not for you
- I have 1000 Hz of bandwidth.
- I need to place x number of 50 Hz blocks of spectrum (carriers) in the 1000 Hz of bandwidth.
- The carriers must be evenly spaced throughout the 1000 Hz of bandwidth and start at 0 Hz.
- I want to plot each frequency that is contained in every carrier across the entire bandwidth of 1000 Hz on the same graph.
So if one carrier starts at 0 Hz, I plot all sine waves of frequencies 0-50Hz and if the next carrier starts at 100 Hz, then I plot 100-150 Hz on the same graph and so forth up to 1000 Hz. This is time domain.
The number of carriers (x) is 5, 10 or 20
when x is 5
num_carrier = 5;
carrier_bandwidth = 50;
total bandwidth = 1000;
total_spacing_bandwidth = total_bandwidth - (num_carrier * carrier_bandwidth);
spacing_bandwidth = total_spacing_bandwidth / (num_carrier+1)
which gives 125 MHz spacing.
Originally the code for plotting was
%How many samples
sampling = 1 /(10^3)
t = 0 : sampling : 10
%frequency range
f=(1: 50 : 1000)
%Loop - needs work
for k = 1:length(f)
y(k,:) = cos(2 * pi .* f(k) .* t)
end
plot(t,y)
But this is giving me a waveform every 50 Hz, I need a block that is 50 Hz in bandwidth and multiple blocks of 50 Hz inside the bandwidth limit of 1000 Hz (with equal spacing between the blocks).
Tricky... is this achievable?
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!