필터 지우기
필터 지우기

Symbolic Toolbox, implicit function as implicit function argument.

조회 수: 1 (최근 30일)
Maciej Bakalarek
Maciej Bakalarek 2019년 11월 10일
답변: Charan Jadigam 2020년 3월 18일
Hello,
I'm working on small project for my studies - magnetic levitation system.
I wanted to check if my linearization calculations were correct. In order to do that I wanted to use Symbolic Toolbox, therefore I need to define:
  • t - time,
  • z(t) - position (time-dependant),
  • L(z(t)) - inductance of coil, which depends on the position of a levitating object
In following lines I'll try to explain what is incomprehensible to me. I will declare syms objects and validate them with following formula:
I imagine I should write script as follows:
%(1)
syms t
syms z(t)
syms L(z(t))
But it results in error: Invalid variable name.
Next I've written script:
%(2)
syms t
syms z(t)
syms L(z)
diff(L,t)
Script results in t being sym object. After 2nd line z is being defined as symfun object, but 3rd line: syms L(z); overrides z(t) as z, thus at the end of script z is a sym object. Result of the script is 0, therefore it's not a good way to define "my symbols".
After some random coding I've came up with:
%(3)
syms t
syms z(t)
syms L(t)
L = L(z);
diff(L,t)
Result of the (pretty) script is:
d
L'(z(t)) -- z(t)
dt
Which I interpretate as...:
L'(z(t)) = dL(z(t)) / dz(t)
This result is compatible with:
And I assume that code (3) is correct. My question is: why? Is it the only way to define such a function in Symbolic Toolbox? Moreover - is it a correct way?

답변 (1개)

Charan Jadigam
Charan Jadigam 2020년 3월 18일
Hi,
I feel that you need to find chain rule using symbolic variables and it could be done in 2 other ways.
First method,
syms t z(t) L
L=str2sym('l(z(t))');
diff(L,t)
Second method,
syms t z(t) L(z)
L = L(z);
diff(L,t)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by