Here's a simple bit of code that exhibits your same error so maybe it will help clarify the issue:
syms x; % Create symbolic variable
a1 = rand(2); % Floating point array 1
a2 = rand(2); % Floating point array 2
d = a1(1)-x; % This is now a symbolic expression
a2(1) = d; % Error: you can't store a symbolic expression in a double array
which in R2013b (and R2015b) returns
The following error occurred converting from sym to double:
Error using mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double
array.
If the input expression contains a symbolic variable, use the VPA function
instead.
vpa
can't be used here because x
is a symbolic variable that hasn't been defined rather than a symbolic value (vpa(d)
has an inconsequential effect).
For your code, the error likely occurs on this line:
Fix_Diagonal_2(loop2,store)=Diagonal;
You can't use vpa
because eigval
is a symbolic variable with no value. You can possibly solve your problem by casting Fix_Diagonal_2
to sym
:
Fix_Diagonal_2 = sym(Fix_Diagonal_2);
You'll probably want to do that outside of the for
loops. I also don't see why you're redefining eigval
on every iteration of the outer loop.