%% SL 5
N1(end:-1:1)
N2(:, 2:2:end)
N3(1:2:end, :)
N2(2, [2 4 5])
A = reshape(1:12, 3, 4).'
A = zeros(3, 4), A(:) = 1:12, A = A.'

%% SL 6
clear; clc;
x = 1:20;
S = cumsum(x);

L = cumsum(x(2:2:end)),

L(end)

%% SL 7
A([1,end], [1,end]) % C

%% SL 10
A(:, [1 end]) = [] % D.

A([2:3 5], :) = B([1 1 1], :)

A([2:3 5], :) = B(ones(1, 3), 1:6)

A([2:3 5], 1:5) = B(ones(1, 3), :)

%% SL 11
M(:, :, 1) = eye(3),
M(:, :, 2) = ones(3),
M(:, :, 3) = diag([2 3 5]),

M(1:2, 1:2, 1) = NaN

%% SL 26

clear; clc;        % clear Workspace
N  = 5; V = 40;    % period, sampling
mu = 0; sigma = 1; % normal distribution
C  = sqrt(2*pi); om0 = pi;
n = mu + sigma*randn(1, N*V) % noise
t  = linspace(0, N*1, N*V); % time
s_t = C*sin(2*om0*t) + n; % signal
plot(t, s_t);

%% SL27
smin = -9/10; smax = pi/2;
sp_t_min = max(s_t, smin);
sp_t     = min(sp_t_min, smax);

close all; 
plot(t, s_t); hold on;
stem(t, sp_t, 'r');

%% SL 31
X = zeros(1, 45);
X(6:15) = 1;
X(16:25) = 2;
X(25:end) = 2:-2/20:0;
stem(X, 'r');

X = [zeros(1, 5) ones(1, 10) 2*ones(1, 9) 2:-2/20:0];
stem(X, 'r');