how can I use syms with spdiags function?

2 views (last 30 days)
fahim GH
fahim GH on 3 Nov 2016
hi how can I fix the following error ? % The following error occurred converting from sym to double: Error using symengine (line 58) DOUBLE cannot convert the input expression into a double array. If the input expression contains a symbolic variable, use VPA. % here's my code : U = sym('u', [20 1]); w=zeros(20,20); w = sym('w', [20 20]); % w = diag(1./sqrt(U)); w = spdiags(1./sqrt(U),0, 20,20); %% I want to have a matrix w of size 20*20 with the diagonals of u1,u2,...u20. thanks alot

Answers (0)

Community Treasure Hunt

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

Start Hunting!