Matlab function block and integration

조회 수: 5 (최근 30일)
Anne
Anne 2023년 4월 7일
댓글: Paul 2023년 4월 8일
Hello!
I am using a Matlab function block in Simulink: https://se.mathworks.com/help/simulink/slref/matlabfunction.html
Since I have a function in which one input is power and I am using it to determine the energy. Also, I use time (clock) as another input. As known the energy is the area under a power function during the period [t1,t2], and usually the integration function is used. However, how should I use this function when using Simulink signals as inputs? Should I multiply the instantaneous power value with the discretization time step (used as the sample time in Powergui) and sum cumulatively sampled energy value results? Is there any smarter solution for that? What would be the best approach in the case of continuous signal?

답변 (1개)

Paul
Paul 2023년 4월 7일
편집: Paul 2023년 4월 8일
If computing the instantaneous power as a function of time, why not feed that into an integerator to find the energy as a function of time?
  댓글 수: 2
Anne
Anne 2023년 4월 8일
Because I need to calcuate it inside MATLAB function block. I have different kind of output, which is not energy but another calculation dependentent of energy. Also, dependent on that energy, the matlab function block has to take specific actions.
Paul
Paul 2023년 4월 8일
The Matlab Function block can accept more than one input. Use an Integrator to compute the energy and then send both power and energy as inputs to the Matlab Function (assuming both are needed).

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

카테고리

Help CenterFile Exchange에서 Switches and Breakers에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by