= cp_als(X,3); %<- Call the method
%%
% We typically can achieve a final fit of f = 0.97. The method stops when
% the change in the fit becomes less than the specified
% tolerance, which defaults to 1-e4. 

%% Visualize the results
% Use the |ktensor/viz| function to visualize the results.
vizopts = {'PlotCommands',{'bar','line','line'},...
    'ModeTitles',{'Concentration','Emission','Excitation'},...
    'BottomSpace',0.10,'HorzSpace',0.04,'Normalize',0};
info1 = viz(M1,'Figure',1,vizopts{:});

%% Run aga