- 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 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Walter Roberson
le 1 Mai 2022
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 commentaires
Voir également
Catégories
En savoir plus sur Conversion Between Symbolic and Numeric dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!