SCIRun User Mailing List

## [SCIRUN-USERS] matlab matrix to tensor

• From: Petar Petrov <pip010@gmail.com>
• To: scirun-users@sci.utah.edu
• Subject: [SCIRUN-USERS] matlab matrix to tensor
• Date: Wed, 6 Oct 2010 12:50:13 +0200
• Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=sPZOWZwtrO8znhKRx7qR2KQtqZLSBX4PebxYSQlRoFWlSYjilex31Op354Cu7gc/QK uznplULUZ2EaRZAqppDiyJjQSeQlyhi2bp01lB0WQD78VxOco+LHviCS0/Z8xYwZ5xjr thDegskKmwixmS9RsKDjo1zXo6Ly9lPSE0iZM=

Hi everyone,
I have some question regarding importing Nx9 matrix generated in Matlab, which represents a tensor field for N nodes (elements in a FEM mesh).

Is there something I should account for manually when doing it, eg: transpose my 3x3 matrix, flip on z-axis, etc. ???

The main issue I have is when visualized, in scirun using glyphview-elipsoids, the tensor field does not resemble correctly the visualization of elipsoids we have in matlab.
second thing is the linear solver does not converge. I assume due to issues with the tensors!

I do generate anisotropic tensors in spherical coordinates as a 3x3 matrix, for each position of node (xyz) and given Ar/At radial/tangential conductivity using the script below:

I would appreciate if someone with experience importing tensors from matlab to give his/her opinion.

==================================================

l=sqrt(x^2+y^2+z^2); %length of vector
sin_rot_y=z/l;
cos_rot_y=sqrt(1-sin_rot_y^2);
sin_rot_z=y/sqrt(x^2+y^2);
cos_rot_z=x/sqrt(x^2+y^2);

Ax=Ar;
Ay=At;
Az=At;

Z=[Ax 0 0;0 Ay 0;0 0 Az];

Ry=[cos_rot_y 0 -sin_rot_y;0 1 0;sin_rot_y 0 cos_rot_y];

Rz=[cos_rot_z -sin_rot_z 0;sin_rot_z cos_rot_z 0; 0 0 1];

M=Rz*Ry*Z;
======================================================

• [SCIRUN-USERS] matlab matrix to tensor, Petar Petrov, 10/06/2010