# How to write Code in Matlab function block in simulink?

조회 수: 4 (최근 30일)
Ajinkya Sonawane . 2020년 8월 8일
답변: Aman Vyas . 2020년 8월 11일
Dear all,
I want to solve four equation in matlab function block in simulink.
four equation are
1. T=(Mf*id);
2. d(ws)/dt=(10000-T+D(314.15-ws));
3. Q=(ws*Mf*iq);
4. d(Mf)/dt=(3000-Q+K(325-V));
Equation are interlink, so, there form a loops. e.g to sole Qs(k) need Mf(k) and to solve Mf(k) need Q(k). And same with T(k) and ws(k), interlink with Mf(k).
So, my question is how to write Code in Matlab function block in simulink to solve this loops?
##### 댓글 수: 2이전 댓글 1개 표시이전 댓글 1개 숨기기
Ajinkya Sonawane 2020년 8월 8일
Thank for the response
I discretize these derivative terms and pass them into seperate delay block that returns ws and Mf back into MATLAB function block. But it did not work

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

### 답변 (1개)

Aman Vyas 2020년 8월 11일
Hi Ajinkya,
From the equations it is clear that all of them are interlinked.
You can get started by :
a) Taking two integral blocks, with d(ws)/dt and d(Mf)/dt as input, you will get ws and Mf as output.
b) Since now you have all the variables available, you can directly pass it to the function block with putting in equations in above fashion.
So considering 2 integral blocks with one matlab function will make your task easier overall.
Hope it helps !

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

### 카테고리

Help CenterFile Exchange에서 Texas Instruments C2000 Processors에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by