clear all
close all
x = -10:10;
y = ones(1, 21);
X = x'*y;
Y = y'*x;
%1
R = max(abs(X), abs(Y));
d = det(R);
R1 = R+eye(21);
d1 = det(R1);
%2
R_inv = inv(R1);
R_ones = ones(21, 21)./R1;
figure('Name','Обращение','NumberTitle','off');
%title('обращение');
subplot(1, 2, 1)
surf(X, Y, -R_inv)
title('inv');
subplot(1, 2, 2);
surf(X, Y, -R_ones)
title('./')
%3
R_sqrtm = sqrtm(R1);
R_sqrt = sqrt(R1);
figure('Name','Извлечение','NumberTitle','off');
%subplot(2, 1, 1)
surf(X, Y, -R_sqrt);
title('sqrt');
%subplot(2, 1, 2)
%surf(X, Y, -R_sqrtm);
%title('sqrtm');
R_logm = logm(R1);
R_log = log(R1);
figure('Name','Логарифм','NumberTitle','off');
%subplot(2, 1, 1)
surf(X, Y, -R_log);
title('log');
%subplot(2, 1, 2)
%surf(X, Y, -R_logm);
%title('logm');
R_expm = expm(R1);
R_exp = exp(R1);
figure('Name','Возведение','NumberTitle','off');
subplot(1, 2, 1)
surf(X, Y, -R_exp);
title('exp');
subplot(1, 2, 2)
surf(X, Y, -R_expm);
title('expn');
%4
R1(1:5, 1:5) = 10;
figure('Name','Отрезание','NumberTitle','off');
surf(X, Y, -R1);
%5
x = -10:10;
y = ones(1, 21);
X = x'*y;
Y = y'*x;
R = sqrt(X.^2 + Y.^2);
ons = ones(3, 3);
%ons(2, 2) = 0;
R_kron = kron(ons, R);
figure('Name','Размножение','NumberTitle','off');
x = -31:31;
y = ones(1, 63);
X = x'*y;
Y = y'*x;
surf(X, Y, -R_kron);
axis equal
x1 = -10:10;
y1 = ones(1, 21);
X1 = x1'*y1;
Y1 = y1'*x1;
ons1 = ones(3, 3);
ons1(2, 2) = 0;
R_kron1 = kron(ons1, R);
R2 = sqrt(X1.^2 + Y1.^2);
R2 = 2*R2 - 10*sqrt(2);
ond = [0, 0, 0; 0, 1, 0; 0, 0, 0];
R_kron2 = kron(ond, R2);
figure('Name','Расширение','NumberTitle','off');
x1 = -31:31;
y1 = ones(1, 63);
X1 = x1'*y1;
Y1 = y1'*x1;
surf(X1, Y1, -R_kron1-R_kron2);
axis equal
%6
figure('Name','heatmap','NumberTitle','off');
subplot(1, 2, 1);
heatmap(-R_kron)
grid off
subplot(1, 2, 2);
heatmap(-R_kron1-R_kron2)
grid off
figure('Name','imagesc','NumberTitle','off');
subplot(1, 2, 1);
imagesc(-R_kron)
grid off
subplot(1, 2, 2);
imagesc(-R_kron1-R_kron2)
grid off
close all
x = -10:10;
y = ones(1, 21);
X = x'*y;
Y = y'*x;
%1
R = max(abs(X), abs(Y));
d = det(R);
R1 = R+eye(21);
d1 = det(R1);
%2
R_inv = inv(R1);
R_ones = ones(21, 21)./R1;
figure('Name','Обращение','NumberTitle','off');
%title('обращение');
subplot(1, 2, 1)
surf(X, Y, -R_inv)
title('inv');
subplot(1, 2, 2);
surf(X, Y, -R_ones)
title('./')
%3
R_sqrtm = sqrtm(R1);
R_sqrt = sqrt(R1);
figure('Name','Извлечение','NumberTitle','off');
%subplot(2, 1, 1)
surf(X, Y, -R_sqrt);
title('sqrt');
%subplot(2, 1, 2)
%surf(X, Y, -R_sqrtm);
%title('sqrtm');
R_logm = logm(R1);
R_log = log(R1);
figure('Name','Логарифм','NumberTitle','off');
%subplot(2, 1, 1)
surf(X, Y, -R_log);
title('log');
%subplot(2, 1, 2)
%surf(X, Y, -R_logm);
%title('logm');
R_expm = expm(R1);
R_exp = exp(R1);
figure('Name','Возведение','NumberTitle','off');
subplot(1, 2, 1)
surf(X, Y, -R_exp);
title('exp');
subplot(1, 2, 2)
surf(X, Y, -R_expm);
title('expn');
%4
R1(1:5, 1:5) = 10;
figure('Name','Отрезание','NumberTitle','off');
surf(X, Y, -R1);
%5
x = -10:10;
y = ones(1, 21);
X = x'*y;
Y = y'*x;
R = sqrt(X.^2 + Y.^2);
ons = ones(3, 3);
%ons(2, 2) = 0;
R_kron = kron(ons, R);
figure('Name','Размножение','NumberTitle','off');
x = -31:31;
y = ones(1, 63);
X = x'*y;
Y = y'*x;
surf(X, Y, -R_kron);
axis equal
x1 = -10:10;
y1 = ones(1, 21);
X1 = x1'*y1;
Y1 = y1'*x1;
ons1 = ones(3, 3);
ons1(2, 2) = 0;
R_kron1 = kron(ons1, R);
R2 = sqrt(X1.^2 + Y1.^2);
R2 = 2*R2 - 10*sqrt(2);
ond = [0, 0, 0; 0, 1, 0; 0, 0, 0];
R_kron2 = kron(ond, R2);
figure('Name','Расширение','NumberTitle','off');
x1 = -31:31;
y1 = ones(1, 63);
X1 = x1'*y1;
Y1 = y1'*x1;
surf(X1, Y1, -R_kron1-R_kron2);
axis equal
%6
figure('Name','heatmap','NumberTitle','off');
subplot(1, 2, 1);
heatmap(-R_kron)
grid off
subplot(1, 2, 2);
heatmap(-R_kron1-R_kron2)
grid off
figure('Name','imagesc','NumberTitle','off');
subplot(1, 2, 1);
imagesc(-R_kron)
grid off
subplot(1, 2, 2);
imagesc(-R_kron1-R_kron2)
grid off