How to evaluate symbolic results over a 3D tensor?

6 views (last 30 days)
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)) );

Answers (1)

Walter Roberson
Walter Roberson on 3 May 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.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!