필터 지우기
필터 지우기

A simulink block function for definite integral

조회 수: 15 (최근 30일)
cyberdyne
cyberdyne 2011년 2월 28일
Hi,
How can i create a definite integral function block with 4 inputs (1st is the function that i want integrate, 2nd is the function "respect to" i want integrate and 3rd and 4th are variable integration bounds) ???
I tried with an Embedded Matlab Funcion:
function y = (f,x,a,b)
y=int(f,x,a,b);
where f is the function to integrate, x is "respect to" function; "a" and "b" are variable integration bounds and where "a" and "b" are x-elements . EML goes to error and says "This call-site passes more inputs to this function that it can accept. ...".
The problem is that Simulink Integrator Block outputs the integral of its input respect time only and most of all it has not inputs to change integration bounds. Instead i need an "universal and definite" integrator block to integrate any function respect to any function and where can i set as input integration bounds.

답변 (3개)

Paulo Silva
Paulo Silva 2011년 2월 28일
You can do the pulse trick
fun-----------------------------I
Product -----> Integrator
step(time=b)----> - sum --------I
+
step(time=a)--------I
Make a subsystem with those blocks and a nice mask for the user to insert a and b
The only part that's missing is the "respect to" function, it's always t
  댓글 수: 1
cyberdyne
cyberdyne 2011년 3월 26일
How can i fit final values of the steps as inputs of the subsystem?

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


MarkB
MarkB 2011년 2월 28일
I think that your best bet would be to use an Embedded MATLAB block for the integration. However, there is one obstacle, which is that there is no "character" or "variable name" data type in Simulink, so there is no real way to make the variable of integration an input.
In a bigger sense, even if the block could accept such an input, it might not be very useful because there would be no other blocks to produce it.
An alternative, would be to have the block use a parameter or refer to a MATLAB base workspace variable that happens to have character data inside of it. This would likely require some use of both the "extrinsic" keyword in EML, as well as a few uses of "eval" and "feval".

Kaustubha Govind
Kaustubha Govind 2011년 2월 28일
Specifically to address the error: There are several MATLAB functions that are called "int" - you are using the function int from the Symbolic Math Toolbox, whereas, the int supported in Embedded MATLAB is from the Fixed-Point Toolbox and takes only one input. This is why you see the error.
Could you elaborate on how this arbitrary function 'f' is represented in Simulink?
  댓글 수: 4
cyberdyne
cyberdyne 2011년 3월 1일
And if i'm able to do it, how can i integrate to apply integration by substitution ?
How can i do it with EML ?
Kaustubha Govind
Kaustubha Govind 2011년 3월 15일
When you have expressed the integral in the equivalent "integral over t" form, you can compute this function for every input and pass into a Integrator block.

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

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by