MATLAB: Trying to solve system of equations symbolically, getting zero for solution

MATLABnon zero answersymbolicsymbolic answersystem of equations

clc
clear
syms x L w n al k1 k2 c1 c2 c3 c4 c5 c6 c7 c8 S
equations = [
c2 + c4 == 0
c6*cos(L*k1) + c8*cosh(L*k2) + c5*sin(L*k1) + c7*sinh(L*k2) == 0
c5*k1*cos(L*k1) + c7*k2*cosh(L*k2) + c8*k2*sinh(L*k2) == c6*k1*sin(L*k1)
c1*(sin(L*k1*n) - k1^2*sinh(L*k2*n)) + c2*cos(L*k1*n) + c4*cosh(L*k2*n) == c6*cos(L*k1*n) + c8*cosh(L*k2*n) + c5*sin(L*k1*n) + c7*sinh(L*k2*n)
c1*k1*cos(L*k1*n) + c6*k1*sin(L*k1*n) + c4*k2*sinh(L*k2*n) == c5*k1*cos(L*k1*n) + c1*k1*cosh(L*k2*n) + c7*k2*cosh(L*k2*n) + c2*k1*sin(L*k1*n) + c8*k2*sinh(L*k2*n)
c1*sinh(L*k2*n) + c2*k1^2*cos(L*k1*n) + c8*k2^2*cosh(L*k2*n) + c1*k1^2*sin(L*k1*n) + c7*k2^2*sinh(L*k2*n) == c6*k1^2*cos(L*k1*n) + c4*k2^2*cosh(L*k2*n) + c5*k1^2*sin(L*k1*n)
c1*k2*cosh(L*k2*n) + c1*k1^3*cos(L*k1*n) + c7*k2^3*cosh(L*k2*n) + c6*k1^3*sin(L*k1*n) + c8*k2^3*sinh(L*k2*n) + L*al*c1*k1^2*sinh(L*k2*n) == c5*k1^3*cos(L*k1*n) + c2*k1^3*sin(L*k1*n) + c4*k2^3*sinh(L*k2*n) + L*al*c2*cos(L*k1*n) + L*al*c4*cosh(L*k2*n) + L*al*c1*sin(L*k1*n)];
S = solve(equations,[c1, c2, c4, c5, c6, c7, c8])
Above is my code, when I run it i am returned with a struct for c1 – c8, intentionally not including a c3 term. However, the solution is only zeros. I realize that this is valid for this system however I am trying to get a result with the symbolic variables of L,K2,K1,al included in the solution for each coefficient c1-c8. When I convert the system into matrix form of AX=b the determinant of A is nonzero and the solution vector b is zero. I am wondering if that could be causing the issue. Thanks in advance.

Best Answer

You have what you claim to be a linear system of 7 equations in 7 unknowns. (I've not checked this claim, carefully, but it looks to be true from a quick glance.)
If you write the system in the form A*x = b, the matrix A is full rank, yet the right hand side is all zero.
Sorry. Basic linear algebra here. There exists only ONE solution to your problem. It is the all zero solution. Nothing you can do will yield a different solution, if the situation is as I have described it. I'm not sure I would say anything caused this result, at least not beyond linear algebra 101.
Why do I say there is no solution as you want? A square matrix that is full rank means that NO non-trivial linear combination of the columns will produce a zero vector. Yet, you are looking for a linear combination of the columns of A that results in b, a zero vector. (Think about what it means to multiply the matrix A by a vector x.) So the only solution is the trivial one: all zeros. It is unique.