m-file code to simulink block
Afficher commentaires plus anciens
Hi all, I have a m-file code and I would like to transfer the m-file code to a simulink block as a source. Can anyone help me?
3 commentaires
Azzi Abdelmalek
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
Can you explain? What is in your m-file
Fang
le 23 Fév 2013
Azzi Abdelmalek
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
What do you want to be your source?
Réponses (1)
Azzi Abdelmalek
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
If you have calculated a signal with your m-file, you can save it in a mat-file, then use a from file block. Specify what do you want to be your source.
t=0:0.1:10
v=sin(t) % The speed
tv=[t;v]
save filename tv
13 commentaires
Fang
le 23 Fév 2013
Azzi Abdelmalek
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
Ok, the graph can't be a source. We need a speed v and the time t. For example, if
t=0:0.1:10
v=sin(t) % The speed
tv=[t;v]
save filename tv
% In your Simulink model use a from file block (in Simulink/Sources) and set the file name to filename
Fang
le 23 Fév 2013
Azzi Abdelmalek
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
Show how did you saved your data in your mat file, and what version of matlab are you using?
Fang
le 23 Fév 2013
Azzi Abdelmalek
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
No , you did not read my answer. I said you must save time and speed in one array.
t=0:0.1:10
v=sin(t) % The speed
tv=[t;v]
save Velocity tv
Fang
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
Azzi Abdelmalek
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
What is d_L ? it should represent a time
A source signal means two variables: time and the values of your signal at each step time
Fang
le 23 Fév 2013
Azzi Abdelmalek
le 23 Fév 2013
Ok, How will you use this in Simulink as a source?
Fang
le 23 Fév 2013
Azzi Abdelmalek
le 23 Fév 2013
Modifié(e) : Azzi Abdelmalek
le 23 Fév 2013
You should read the basics of Matlab and Simulink. You can't get help like this.
Fang
le 23 Fév 2013
Catégories
En savoir plus sur Sources dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!