Info

This question is closed. Reopen it to edit or answer.

How can i import a signal and make its frequency as an input parameter.

2 views (last 30 days)
Hi,
I created a signal in the matlab workspace and i want to import it to simulink and be able to change its frequency.
The vector that describe my signal is this one : [[5:0.25:10]/10,ones(1,15),zeros(1,65)]
I tried to use the repeating sequence block but i could not set the frequency as an input. So i would like to know if its possible to import this signal to Simulink and have the frequency as a parameter so i can change it.
This signal will be generated by a DSP, and i would like to communicate with the it to change the frequency so i really need it as an input parameter
Thank you

Answers (1)

Fangjun Jiang
Fangjun Jiang on 26 Aug 2020
Your data has 101 points (or 100 intervals). The period of the signal is 1/F, where F is your frequency. So you need to do
Data=[[5:0.25:10]/10,ones(1,15),zeros(1,65)];
F=1;
Time=linspace(0,1/F,numel(Data))
Then use Data and Time to specify the Repeating Sequence block
  2 Comments
Fangjun Jiang
Fangjun Jiang on 27 Aug 2020
In this case, "F" would be a parameter to your model but not a time-varying signal. Specify the time for the Repeating Sequence block as "linspace(0,1/F,101)" and change the value of F before every simulation, but not during a simulation.

Community Treasure Hunt

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

Start Hunting!