Solve a system of symbolic equations

1 view (last 30 days)
Hi all,
I am discovering symbolic calculation in Matlab. I have to solve a system of equations that I don't want to solve by hand... :D
It is a mechanical problem based on the classical laminate theory for composite materials. The aim is to exploit data from tensile coupons tests.
% Stack-up of the coupon
% [orientation (in °), thickness (in mm)]
plies = sym([-60 1; 60 1; 60 1; -60 1]);
plies(:,1) = plies(:,1).*pi/180;
syms E1 E2 G12 nu12 nu21; % Mechanical properties of the ply
syms Q11 Q12 Q22 Q66; % Stiffness matrix in the orthogonal frame
syms Q11L Q12L Q22L Q66L; % Stiffness matric in the laminate frame
syms A11 A12 A22 A66 D11 D12 D16 D22 D26 D66; % Laminate ABD matrix
nu21 = nu12 * E2/E1;
Q11 = E1/(1-nu12*nu21);
Q12 = nu21*E1/(1-nu12*nu21);
Q22 = E2/(1-nu12*nu21);
Q66 = G12;
Qply = [ Q11 Q12 0;
Q12 Q22 0;
0 0 Q66];
ATemp = zeros(3,3);
% Generates Aij of the laminate ABD matrix
for i=1:size(plis,1)
ALam = ATemp + frameRotation(Qply, plies(i,1)).*plies(i,2);
ATemp = ALam;
end
clear ATemp
subexpr(ALam)
% Test hypothesis:
% 1st tensile test in the direction 1
% - Tensile load NL1
% - 2 deformation gages dir 1 et 2 : j11 et j21
% 2nd tensile test in the direction 2
% - Tensile load NL2
% - 2 deformation gages dir 1 et 2 : j12 et j22
% System 1 :
% { NL1 = A11 j11 + A12 j21
% { 0 = A12 j11 + A22 j21
% System 2 :
% { NL2 = A22 j12 + A12 j22
% { 0 = A12 j12 + A11 j22
% ==> 4 equations / 4 unknowns (E1, E2, nu12, G12)
NL1 = (1000);
NL2 = (500);
j11 = (0.000001);
j21 = (0.0000001);
j12 = (0.0000002);
j22 = (0.000002);
solu = solve(ALam(1,1)*j11 + ALam(1,2)*j21 - NL1, ...
ALam(1,2)*j11 + ALam(2,2)*j21, ...
ALam(2,2)*j12 + ALam(1,2)*j22 - NL2, ...
ALam(1,2)*j12 + ALam(1,1)*j22, ...
E1, E2, G12, nu12)
And the frameRotation function :
function Qlam = frameRotation(Qply, theta)
% This function computes the ply stiffness matrix Q in the laminate frame
% Qlam = Qply(theta)
Q11 = Qply(1,1);
Q12 = Qply(1,2);
Q22 = Qply(2,2);
Q66 = Qply(3,3);
t = theta;
Q11L = Q11*cos(t)^4 + Q22*sin(t)^4 + 2*(Q12+Q66)*sin(t)^2*cos(t)^2;
Q12L = (cos(t)^4+sin(t)^4)*Q12 + (Q11+Q22-2*Q66)*sin(t)^2*cos(t)^2;
Q16L = (Q11-Q12-Q66)*sqrt(2)*sin(t)*cos(t)^3 + (Q12-Q22+Q66)*sqrt(2)*cos(t)*sin(t)^3;
Q22L = Q22*cos(t)^4 + Q11*sin(t)^4 + 2*(Q12+Q66)*sin(t)^2*cos(t)^2;
Q26L = (Q11-Q12-Q66)*sqrt(2)*sin(t)^3*cos(t) + (Q12-Q22+Q66)*sqrt(2)*cos(t)^3*sin(t);
Q66L = (cos(t)^4+sin(t)^4)*Q66 + (Q11+Q22-2*Q12-Q66)*2*sin(t)^2*cos(t)^2;
Qlam = [ Q11L Q12L Q16L;
Q12L Q22L Q26L;
Q16L Q26L Q66L];
The problem is that I don't understand the results that the solve function gives me :
>> [solu.E1 solu.E2 solu.G12 solu.nu12]
ans =
[ (961*z1)/169, z1, z, -31/13]
[ 0, z1, z, 0]
[ 0, 0, z1, z]
What are these z and z1?? Do you understand where is the problem?
Thank you very much!
Max

Accepted Answer

Walter Roberson
Walter Roberson on 9 Dec 2013
MuPAD has found that the set of solutions is most easily expressed by introducing some temporary variables, z and z1, instead of fully writing out the same subexpression each time.
Imagine for example that one was solving a quadratic with real-valued solutions. Instead of writing out some long expression on both parts, with the second solution just being the negative of the first, MuPAD might introduce a temporary variable z to represent the long expression, and then say that the results are [z, -z] where z is ....
Unfortunately the interface between MuPAD and MATLAB fails to return back what the temporary expression is in some cases, in some releases.
Consider firing up the mupad notebook; see http://www.mathworks.com/help/symbolic/mupad.html
There are some alternatives to firing up the MuPAD notebook, but they mostly involve giving a sequence of MuPAD commands into an evalin() expression. For example, telling MuPAD to write the results to a file.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!