How to evaluate symbolic results over a 3D tensor?

7 次查看(过去 30 天)
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)) );

回答(1 个)

Walter Roberson
Walter Roberson 2020-5-3
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.

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by