syms w;

% original matrix
W = [1 1 1 1 1; 
  1 w w^2 w^3 w^4; 
  1 w^2 w^4 w w^3; 
  1 w^3 w w^4 w^2; 
  1 w^4 w^3 w^2 w];

% matrix with 13 nonzero entries
S = [1/w-1 0 0 0 0; 
  0 0 w-w^2 w-w^3 w-w^4;
  0 w-w^2 w-w^4 0 w-w^3;
  0 w-w^3 0 w-w^4 w-w^2;
  0 w-w^4 w-w^3 w-w^2 0];

disp(['The rank of W+S is: ',num2str(double(rank(W+S)))]);

