function [X, Y] = generate_data2(cfg) % This function generates normally distributed data containing the % specific relations studied in the examples. % Uurtio et al. A Tutorial on Canonical Correlation Methods. 2017. %-------------------------------------------------------------------------- % Input % n: number of observations % Output % X_a: The data matrix of view a % X_b: The data matrix of view a %-------------------------------------------------------------------------- % © 30/01/2017 Viivi Uurtio, Aalto University % viivi.uurtio@aalto.fi % % This code is for academic purposes only. % Commercial use is not allowed. %-------------------------------------------------------------------------- % % AM 19-07-2016: adaptation to take inputs from cfg and handle Y % dimensionality flexibly for i = 1:cfg.data.X.nfeat X(:,i) = normrnd(0,1,[cfg.data.nsubj 1]); end y1 = X(:,3) + normrnd(0,0.01,[cfg.data.nsubj 1]); % 0.01 y2 = X(:,1) + normrnd(0,0.03,[cfg.data.nsubj 1]); % 0.03 y3 = -X(:,4) + normrnd(0,0.02,[cfg.data.nsubj 1]); % 0.02 for j = 1:cfg.data.Y.nfeat-3 Y2(:,j) = normrnd(0,1,[cfg.data.nsubj 1]); end Y = [y1 y2 y3]; if exist('Y2', 'var') Y = [Y Y2]; end end