How to integrate a function inside a ssc ?

Hi,
I would like to perform a integration inside a ssc code (so in the Simscape environment not the matlab one) but i did not find how to do it and if it's possible. I'm not talking about a integration over time for which I already found something.
My function looks like that 1/(0.05+0.015 exp(100x)), a primitive of this function is not very easy to find, this is why i would like to integrate between 0 and let's say 0.01. Furthermore, my function could change a bit.
Is there a way to do that ?
Thanks,
Léo

답변 (1개)

Torsten
Torsten 2022년 12월 20일
syms x
f = 1/(0.05+0.015*exp(100*x));
int(f)
ans = 

댓글 수: 6

Léo Jan
Léo Jan 2022년 12월 21일
Thanks for your quick answer Torsten !
Unfortunately, I don't have the Symbolic Math Toolbox and it seems that it can only be used in the Matlab environment and not the Simscape one. I will edit my question to specify that.
Have a good day,
Léo
Torsten
Torsten 2022년 12월 21일
But you can copy the antiderivative from screen and use it in your code, don't you ?
Léo Jan
Léo Jan 2022년 12월 22일
Yes of course. But as I said, my function could change a bit and so the antiderivative !
Torsten
Torsten 2022년 12월 22일
Yes of course. But as I said, my function could change a bit and so the antiderivative !
During the simulation process ? That's unusual.
If you know it beforehand, you can come back and I'll try to get the antiderivative with the symbolic toolbox.
You can also use
to do symbolic integration.
Léo Jan
Léo Jan 2023년 1월 4일
You're right, in my case, it doesn't change during the simulation.
So i will use the tool you've linked.
Should I understand that the integration is impossible in a ssc file ?
Torsten
Torsten 2023년 1월 4일
편집: Torsten 2023년 1월 4일
Should I understand that the integration is impossible in a ssc file ?
Up to now, I thought that the missing symbolic toolbox was the problem.
I know symbolic computations are not possible in ssc files, but since you don't have the symbolic toolbox ...
Once you have the equation for the integral, you can use it in an ssc file as a function handle.
So in short: I don't know what your question aims at (i.e. what problems you encounter when you try to integrate in an ssc file).
Maybe it can be answered here:

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

제품

릴리스

R2021b

질문:

2022년 12월 20일

편집:

2023년 1월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by