How To Select Signals

Hi All I'm making a frequency hopping system 10M - 110-MHZ (Simulink)
I have X Freq.s and i want to choose between them by a sequence of numbers but the main problem is how to make a variable sine wave in Simulink (Discrete) but after some time made a NCO but its max Memory is N = 25 and that limit the Max o/p Freq. and tried the VCO but No luck at this also
So i decided to make the wanted Freq.s and select between them so that i made (N Sine Waves & Variable Selector) and i select the wanted freq. by the IDX (by a constant No.) but as i monitored the o/p's of the Variable Selector all the o/p's have signals not the selected one.
So Please If any one could help me to make this system (How to choose one of many signals but from external Index as MUX but with external Selection)?
here is a demo of the system;- http://ifile.it/54l7mo3
Thanks In Advance I.G

 Accepted Answer

Fangjun Jiang
Fangjun Jiang on 9 Sep 2011

0 votes

Use "Multiport Switch" block from the "Signal Routing" library.

4 Comments

Thanks Fangjun
it works
but there is a problem the o/p as it select from Freq1 to Freq2 its not Continuous Phase and that make the system have a delta at 0 freq.
so what to do at this?
thanks again
so is there any way to solve this problem
I understand you want a smooth transition, which is hard to get using a switch block. What you need is signal=sin(2*pi*f*t) where f is varying. Can you try to generate this signal in a 'Fcn' block? Type in sin(2*pi*u(1)*u(2)) in the dialog window. Outside of it, you need to provide the u(1) which is your varying frequency, u(2) can be generated using the 'Clock' block. Mux the two together and then feed it to the 'Fcn' block. Remember if you want the sine wave be smooth, you need to change the frequency smoothly too.
Thanks Very Much You Really Helped me
But there is another Problem Faced Me
i was using randint(1,100,78) and sampling time = 1/1600 to generate the hopping sequence (and it really working like a charm)but this is random so i generated a Gold Code sequence and i want to use it to switch the freq's but i tried many things but no luck
1- making a LUT and select the values from it but it did not work
2- making Repeating Sequence Stair but not worked as well
So Please What I Can Do
I Uploaded the File here :-
http://ifile.it/t5vbg9m
and The Sequence here :-
http://ifile.it/do4g8ty
Thanks In Advance
Thanks Fangjun Jiang
the Repeating Sequence Stair worked
the main problem was the sampling rate
Thanks Again
Islam Galal

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!