simulink &m-file

i have m-file code and a simulink model can i convert m-file code to block in simulink which i can make its input port a sinusoidal signal and its output port frequency of this signal m-file code: {%x input signal and fre output y=fft(x)/fs; y=fftshift(y); y=abs(y); fre=.5*fs+1-find(y==max(y),1);}

 采纳的回答

Kaustubha Govind
Kaustubha Govind 2012-3-19

0 个投票

6 个评论

i did not want to call simulink but i want to build a block in simulink with code like the above code
Isn't that exactly what the first sentence in that answer explains?
yes, i need to make function which connected simulink with m-file with gui simultaneously (i make radar system output of simulink model is fft of extracted signal then output of m-file is the freq of signal then calculate range then plot x-point in graph)
So that answers your question then? If yes, please accept the answer.
if i use simulation time inf.?
You can use any simulation time, that doesn't affect the operation of the block - the model will just keep running until you stop it.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Simulink 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by