%% SL21
close all; clear; clc
[x1, f1] = myFunc(-1:0.2:1);
[x2, f2] = myFunc(-1:0.1:1);
[x3, f3] = myFunc(-1:0.01:1)
figure;
hold on; grid on;
plot(x1, f1, 'r');
plot(x2, f2, 'g');
plot(x3, f3, 'b');
legend('0.2', '0.1', '0.01');
function [x, f] = myFunc(x)
f = x .* sin(pi/2*(1+20*x));
end

%% SL 27
A = @(p) [cos(p).^2, sin(p)+cos(p), 1*ones(size(p))]
p = linspace(0, 2*pi).';
plot(p, A(p));