I do not recognize "finsym". There is an older symbolic toolbox function named "findsym", but it would be of no practical use unless you either displayed the output or used the function form of it and assigned the output to something.
The symbolic toolbox has a "solve" function. As is the case for all functions used in "function / command" equivalence, if you use the command form of it, then each (whitespace-delimited) string that follows on the command line is passed as a string input to the function. For example,
addpath C:\system x86\MATLAB
would be equivalent to calling
addpath('C:\system', 'x86\MATLAB')
Thus, invoking solve in the way you have invoked it would be equivalent to invoking
solve('''-zm''*inv(M)*inv(W)*Q*inv(W)*inv(M)*zm''');
Notice that because you used the command form, the quotes you provided become a literal part of the input.
Even if you had not provided the quotes yourself and had invoked
solve -zm'*inv(M)*inv(W)*Q*inv(W)*inv(M)*zm
then this would be equivalent to calling
solve('-zm''*inv(M)*inv(W)*Q*inv(W)*inv(M)*zm')
However because you are passing a string in to solve, solve() will only know the values of any variables which you have defined in the symbolic toolbox itself (not at the MATLAb level!). You have not defined any values at the level of the symbolic toolbox itself, so you are asking solve to solve the equation completely symbolically, which it is not able to do.
So what should you be doing? Well, you could be invoking,
solve(-zm'*inv(M)*inv(W)*Q*inv(W)*inv(M)*zm)
and then the expression will be evaluated at the MATLAB level and the result of the expression will be passed to solve(). This is generally a Good Thing To Do.
Now, I said generally a good thing to do, not always. If you go back through your code, you will see that at that point in your code, you have no undefined variables, so the expression will either evaluate to 0 or it will not evaluate to 0, and there is nothing for solve() to do.
You could be keeping track of the minimum (absolute) value over the loop, or you could be using fzero() or fsolve().
If you do keep track of the minimum value over the loop, you will find that your loop does not produce any solutions at all. You calculate gamma = min(abs(G)) so you know gamma is a non-negative real number. You then loop for lambda = 0:-1/gamma . Regardless of whether gamma is less than 1 or greater than 1, unless gamma is infinity, -1/gamma will be negative, leading to a loop request starting from 0, incrementing by 1, and ending at a negative number. That's an empty loop. (If gamma is +infinity, then the loop would be 0:0 which would be done once with lambda=0)
Please reconsider your code.
By the way, based upon your previous postings, I don't think you want
You wanted the smallest eigenvalue, and you specifically clarified that -5 is smaller than -1/2, which would correspond to
with further clarification from you needed if G contains complex values.
If you are looking for the entry in G which has the smallest absolute value, then you need to use
[gamma, idx] = min(abs(G));
gamma = G(idx);
This could then be positive or negative; a negative value at least gives the possibility that -1/gamma would be positive (and at least 1) so your loop could proceed as written... but then one would expect that you would want to have code to deal with the possibility that the minimum value happened to be positive so -1/gamma was negative...
=====
Addition, possible modified code. Note that I did not fix the selection of eigenvalues, as you need to clarify that.
[Modified Nov 28 2011, 14:34 - p parameter, Q optimization] [Modified Nov 28 2011, 14:53 - conjugate transpose giving syntax problem]
function lambda = drive_zr17t9(p)
format short e;
load saved_data;
theta = pi/2;
zeta = cos(theta);
I = eye(n,n);
Q = zeta*I-p*p';
Mroot = M.^(1/2);
T = Mroot*Q*Mroot;
E = eig(T);
ind = find(E<0);
G = E(ind);
gamma = min(abs(G));
bounds = sort([0, -1/gamma]);
Minv = inv(M);
lambda = fzero(@(lambda) zr17t9(lambda, Minv, Q, zm), bounds);
end
function r = zr17t9(lambda, Minv, Q, zm)
Winv = inv(mInv+lambda.*Q);
r = -ctranspose(zm)*Minv*Winv*Q*Winv*Minv*zm;
end