We have an optimal dimensionality
when the increase in the complexity of the model no longer increases the fit of the model significantly. Always mind the principle of parsimony to obtain robust and simple models. One can use the development in SSE as the model increases in dimensionality to indicate the best/simplest model of X.
The smart way
Since you have previously verified that the fit is independent of the factors being orthogonal or unconstrained, you should definitely use the orthogonal ‘tucker’ function to save a considerable amount of time.
A way to try all the feasible models automatically in MATLAB is
for i=1:4, for j=1:4, for k=1:4, W=[i j k];
if prod(W)/max(W) >= max(W), W, p=p+1; Z(p,1:3)=W;
[Factors,G,SSE(p)] = tucker(X,W);
end; end; end; end;
plot(SSE(j)); grid on;
text(i,SSE(j(i)), ['(' num2str(Z(j(i),:)) ')']);
title('SSEx as function of Tucker3 model dimensionality');
xlabel('Tucker3 model dimensionality (sorted)');
ylabel('Explained variation of X');