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);}

 Réponse acceptée

Kaustubha Govind
Kaustubha Govind le 19 Mar 2012

0 votes

6 commentaires

mohamed  al-asklany
mohamed al-asklany le 19 Mar 2012
i did not want to call simulink but i want to build a block in simulink with code like the above code
Kaustubha Govind
Kaustubha Govind le 20 Mar 2012
Isn't that exactly what the first sentence in that answer explains?
mohamed  al-asklany
mohamed al-asklany le 20 Mar 2012
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)
Kaustubha Govind
Kaustubha Govind le 21 Mar 2012
So that answers your question then? If yes, please accept the answer.
mohamed  al-asklany
mohamed al-asklany le 22 Mar 2012
if i use simulation time inf.?
Kaustubha Govind
Kaustubha Govind le 22 Mar 2012
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by