- call the symbolic function passing in symbolic parameters, getting out a symbolic array that you then index; or
- create g as a cell array instead of using []. You would not be able to directly do things such int(g) or directly evaluate g at a parameter, but you would be able to index; or
- use unsupported calls into the symbolic engine and arcane knowledge to do the indexing.
matric component of symbolic fuction
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm using matlab live editor and trying to get a specific component of a variable function of matric
-------------------------------------------
clc
clear all
syms r Phi(r) Lambda(r) theta t phi
xa=[t;r;theta;phi]
n=4;
g=[-exp(-2*Phi),0,0,0; 0, exp(-2*Lambda),0, 0; 0,0,r^2*theta^2,0; 0,0,0,r^2* (sin(theta))^2 ]
-----------------------------
for example I would like to have g(1,1) but g is function of r, g(1,1) doesn't work...
Is there any good way to figure our this problem..?
I need "for" loop to calculate some symbolic algebra for each component
Thanks in advance
댓글 수: 0
답변 (1개)
Walter Roberson
2022년 5월 1일
There is no way to do that in MATLAB, at least not without knowing the internal operations of the Symbolic engine.
In MATLAB when you create a symbolic function that is non-scalar, there is no way (short of internal operations) to index the function to get to one particular calculation.
You have several options at this point:
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!