필터 지우기
필터 지우기

How can i connect simulink and matlab together?

조회 수: 55 (최근 30일)
Pooria Dinarvandi
Pooria Dinarvandi 2019년 1월 18일
답변: Pooria Dinarvandi 2019년 1월 30일
hi,
in my matlab code the Parameters K1, K2, K3, K4, K5 and K6 should be calculated from the given variables. The matlab code is just a function which is calculating the Parameters / Gains. I have a simulink file (attached in Photo) and as i said, the matlab code calculates the Gains(K1 to K6). I want to have the programm so, that when i run it, the gains(K1 to K6) will be directly read from the matlab code which i have alredy written and calculated the gains.
My question is, how can i connect the simulink and matlab code together?
I appreciate the answers.
Regards,
Pooria

답변 (2개)

Naman Chaturvedi
Naman Chaturvedi 2019년 1월 21일
The variables K1-K6 should just be present in the base workspace and Simulink will pull the values from there. If you have a function that is assigning values to the variables, make sure you are returning the values to the base workspace.
Hope this helps.
  댓글 수: 1
Pooria Dinarvandi
Pooria Dinarvandi 2019년 1월 30일
thank you so much for the response.
But cause i am new to Matlab, how can i return the values back to base workspace?
As you can see, the "calculate.m" is the function i have used to calcualate the K1 to K6 and on the "blockdiagramm" i have tried to sketch the graphs.
I appreciate your time!
regards,
Poori
Screenshot 2019-01-29 at 21.00.34.png

댓글을 달려면 로그인하십시오.


Pooria Dinarvandi
Pooria Dinarvandi 2019년 1월 30일
Screenshot 2019-01-29 at 20.57.10.png

카테고리

Help CenterFile Exchange에서 Create Large-Scale Model Components에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by