How to evaluate symbolic results over a 3D tensor?

조회 수: 7 (최근 30일)
Mirlan Karimov
Mirlan Karimov 2020년 5월 3일
답변: Walter Roberson 2020년 5월 3일
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