How to evaluate symbolic results over a 3D tensor?

6 visualizaciones (últimos 30 días)
Mirlan Karimov
Mirlan Karimov el 3 de Mayo de 2020
Respondida: Walter Roberson el 3 de Mayo de 2020
I want the following results to be evaluate over a m x m x m 3D tensor defined by [X,Y,Z] = meshgrid(x,x,x) where length(x) = m. The problem is that are the elementwise square and multiplication, respectively. How do I solve the problem?
syms t x y z C w a alpha
% alpha = 0;
X = [x,y,z];
Xbar = int(int(int(X,x,-a,a),y,-a,a),z,-a,a)/(8*a^3);
%Example1
v = [sin(C*t)*x + cos(C*t)*y - w/2*y; cos(C*t)*x + w/2*x - sin(C*t)*y + x*y;0];
A = [-sin(C*t), cos(C*t) - w/2; cos(C*t) + w/2 + x^2 + y*x, - sin(C*t)];
vbar = int(int(int(v,x,-a,a),y,-a,a),z,-a,a)/(8*a^3);
W = 0.5 * ( jacobian(v,X) - transpose(jacobian(v,X)) );
SKEW = 0.5 * ( (v-vbar)*(X-Xbar) - transpose((v-vbar)*(X-Xbar)) );

Respuestas (1)

Walter Roberson
Walter Roberson el 3 de Mayo de 2020
You should be able to just subs() in the 3d grid.
The symbolic toolbox treats all names as representing scalars, implicitly using elementwise operations including assuming commutative. x*u will be assumed to be the same as y*x for example. You do not need to write the dot versions of the operations because they assumed.
Then later when you subs() in non-scalars it more-or-less does arrayfun, doing elementwise operations.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by