Info

此问题已关闭。 请重新打开它进行编辑或回答。

Trouble integrating function & trouble plotting it to see if there are singularities

1 次查看(过去 30 天)
Hi all,
I have a rather complex function that i am trying to integrate - it is the result of trying to re-orient the compliance matrix of a fibre reinforced epoxy.
the compliance matrix (S) is a 6X6 matrix and is an input The transformation matrices are 2 6x6 matrices (T1, T2)
function[S_prime] = orientation_random_3(S)
% 3D Orientational average of compliance matrix as defined by RUC subject
% to periodic BC's
% T1 = Stress Transformation Matrix
% T2 = Strain Transformation Matrix
% S = Compliance Matrix of RUC
% theta = angle from X1 axis
% phi = angle from X3 axis
% Input 6x6 compliance matrix
% Output 6x6 orientational averaged compliance matrix
syms('x','y');
pi = 3.14159265359;
S_prime_variable = zeros(6); S_Prime = zeros(6);
T1 = [cos(y).^2.*cos(x).^2,sin(y).^2.*cos(x).^2,sin(x).^2,-2.*sin(y).*cos(x).*sin(x),-2.*cos(y).*cos(x).*sin(x),2.*cos(y).*sin(y).*cos(x).^2;sin(y).^2,cos(y).^2,0,0,0,2.*cos(y).*sin(y);cos(y).^2.*sin(x).^2,sin(y).^2.*sin(x).^2,cos(x).^2,-2.*sin(y).*cos(x).*sin(x),2.*cos(y).*cos(x).*sin(x),-2.*cos(y).*sin(y).*sin(x).^2;sin(y).*cos(y).*sin(x),-sin(y).*cos(y).*sin(x),0,cos(y).*cos(x),sin(y).*cos(x),(cos(y).^2-sin(y).^2).*sin(x);cos(y).^2.*cos(x).*sin(x),-sin(y).^2.*cos(x).*sin(x),-sin(x).*cos(x),sin(y).*(cos(x).^2+sin(x).^2),cos(y).*(cos(x).^2-sin(x).^2),0;cos(y).*sin(y).*cos(x),cos(y).*sin(y).*cos(x),0,-cos(y).*sin(x),-sin(y).*sin(x),(cos(y).^2+sin(y).^2).*cos(x)];
T2 = [cos(y).^2.*cos(x).^2,sin(y).^2.*cos(x).^2,sin(x).^2,-sin(y).*cos(x).*sin(x),-cos(y).*cos(x).*sin(x),cos(y).*sin(y).*cos(x).^2;sin(y).^2,cos(y).^2,0,0,0,cos(y).*sin(y);cos(y).^2.*sin(x).^2,sin(y).^2.*sin(x).^2,cos(x).^2,-sin(y).*cos(x).*sin(x),cos(y).*cos(x).*sin(x),-cos(y).*sin(y).*sin(x).^2;2.*sin(y).*cos(y).*sin(x),-2.*sin(y).*cos(y).*sin(x),0,cos(y).*cos(x),sin(y).*cos(x),(cos(y).^2-sin(y).^2).*sin(x);2.*cos(y).^2.*cos(x).*sin(x),-2.*sin(y).^2.*cos(x).*sin(x),-2.*sin(x).*cos(x),sin(y).*(cos(x).^2+sin(x).^2),cos(y).*(cos(x).^2-sin(x).^2),0;2.*cos(y).*sin(y).*cos(x),2.*cos(y).*sin(y).*cos(x),0,-cos(y).*sin(x),-sin(y).*sin(x),(cos(y).^2+sin(y).^2).*cos(x)];
S_prime_variable = T2\S*T1;
%My goal is to integrate each of the 36 terms of S_prime_variable from 0->pi over x, and 0->2pi over y.
for j=1:6
for i=1:6
fun = matlabFunction(S_prime_variable(i,j)*sin(x));
k = int(fun,x);
l = subs(k,x,pi);
m = subs(k,x,0);
n = l-m;
n2 = matlabFunction(n);
o = int(n2,y);
p = subs(o,y,2*pi);
q = subs(o,y,0);
S_Prime(i,j) = (p-q);
end
end
with the above code i get an error @ o:
Error using mupadmex
Error in MuPAD command: Unexpected 'identifier' [line 1, col 253]
Error in sym/int (line 110)
r = mupadmex('symobj::intindef',f.s,x.s,options);
Error in orientation_random_2 (line 46)
o = int(n2,y);
I am only integrating this way because i have had incredible amount of trouble trying 2D integration techniques.
Further, while trying to evaluate the functions by creating a meshgrid and meshing the surfaces, i get the following error:
Error using mesh (line 76)
X, Y, Z, and C cannot be complex.
Here is an example input compliance matrix:
X = [0.2174,-0.0630,-0.0630,0,0,0;-0.0630,0.5832,-0.2748,0,0,0;-0.0630,-0.2748,0.5832,0,0,0;0,0,0,0.858,0,0;0,0,0,0,0.858,0;0,0,0,0,0,0.858]
Does anyone have an idea how to evaluate at least what is going on? Im totally lost here and have been struggling for over a week.
Any help would be greatly appreciated!!

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by