How to solve an integral equation in simulink?

9 ビュー (過去 30 日間)
Leon Rinke
Leon Rinke 2021 年 3 月 9 日
コメント済み: Leon Rinke 2021 年 3 月 17 日
I need to solve the following equation in simulink:
I have ξ (= xi) as an input and need iav as an output to forward it to other blocks. I tried to use the MATLAB function block, but the code I've written doesn't work.
function iav = fcn(xi)
syms xi phi iav
fun = 1/(sqrt(1-(1-phi^(3/2))*((1-iav)*xi)^(3/2)));
eqn = (1-iav)*int(fun,phi,0,1)==1;
iav = solve(eqn,iav);
Any help would be much appreciated. Thanks in advance.


Deepak Meena
Deepak Meena 2021 年 3 月 17 日
Please let us know what error exactly you are getting while using Function block in Simulink.
My Initial guess is that error might be coming because iav is returning as empty symbolic variable . I tried to run the your function on your end and the value you passing to the function is not getting assigned to the symbolic Variable xi.
Also it is advised to convert the iav to double before returning.
function t = fcn(txi)
syms xi phi iav
xi = txi;
fun = 1/(sqrt(1-(1-phi^(3/2))*((1-iav)*xi)^(3/2)));
eqn = (1-iav)*int(fun,phi,0,1)==1;
iav = vpasolve(eqn,iav);
t = double(iav);
  3 件のコメント
Leon Rinke
Leon Rinke 2021 年 3 月 17 日
Thanks a lot. I was able to remove the errors too. But, your right. The simulation now just takes forever because of that.
Can you think of any other solution to solve this problem? Maybe an entirely different approach which would be quicker?


その他の回答 (0 件)


Find more on Agriculture in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by