Can i add heaviside step function in Matlab runtime library?

I'm having issue with heaviside step function with Matlab runtime.
I have main.m which includes heaviside step function inside it. No problem with Matlab itself.
My workflow is : Compiling main.m to executable file and submit it to computational node on Centos.
To do this, i installed Matlab Runtime. However, it shows error message that it can't find the heaviside function.
So, i want to add heaviside function to Runtime library if i could.
Is it possible?
If is not possible, is it the only to install Matlab itself on computational nods?
Thank you.

 채택된 답변

Steven Lord
Steven Lord 2020년 4월 13일

0 개 추천

Are you trying to call the heaviside function in Symbolic Math Toolbox? Nothing in Symbolic Math Toolbox is supported for use with MATLAB Compiler.
Are you trying to call the heaviside function in Simulink Test? That too is not supported for use with MATLAB Compiler.

댓글 수: 3

Thank you for your reply. I guess i used heaviside function in Symbolic Math Toolbox.
So i just write custom made heaviside step function to avoid using Symbolic Math Toolbox.
I'm trying to do simple math algebra.
I made function called unit(x). Then, when i call say for example, h(1) i got this messages:
If i use heaviside rather than unit, there is no problem...
How can i handle this? Again, thank you.
Code line----------------------------------------------------------------------------------
function ans = h(E)
y = @eta;
ans = int(y, -inf, E);
end
function ans = eta(x)
ans = unit(x+1)-unit(x-1);
end
function ans = unit(x)
if x>0
ans = 1;
elseif x==0
ans = 1/2;
else
ans = 0;
end
end
For numeric integration use integral. But you'll need to either tell integral that your function is 'ArrayValued' or you'll need to modify your unit function to properly handle being called with a vector of values for x. See the documentation page for if to understand how it behaves when the condition is non-scalar.
Thank you Steven. It was really helpful to solve this problem.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2020년 4월 13일

댓글:

2020년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by