Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

2 次查看(过去 30 天)
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

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2020-8-26
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 个评论
Fangjun Jiang
Fangjun Jiang 2020-8-27
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!

Translated by