How do I plot the infinite norm of a matrix on a graph?. I should have a square but I end up having a circle

11 次查看(过去 30 天)
A=[2 0;1 -1]; Matrix A %(Sample Matrix)
infnorm=norm(A,inf) %Infinite norm
theta=linspace(0,2*pi,601); % Using 601 points
x=[cos(theta);sin(theta)];
plot(infnorm*x(1,:),infnorm*x(2,:),'--'), axis equal
title('Unit circle in Infinite-norm')
xlabel('x_1'), ylabel('x_2') %labels

回答(1 个)

Sam Chak
Sam Chak 2023-9-29
Perhaps you want to plot something like this:
p = [1, 2^1, 2^2, 2^3, 2^4];
for j = 1:length(p)
f = @(x,y) abs(x).^p(j) + abs(y).^p(j) - 1;
fimplicit(f, [-3/2, 3/2, -3/2, 3/2])
hold on
end
hold off
grid on, xlabel('x_{1}'), ylabel('x_{2}')
axis square
title({'Unit circles in the $p$-norm'}, 'interpreter', 'latex', 'FontSize', 12)
text(0.25, 0.4, 'p = 1', 'FontSize', 9)
text(0.60, 0.60, '2', 'FontSize', 9)
text(0.75, 0.77, '4', 'FontSize', 9)
text(0.85, 0.88, '8', 'FontSize', 9)
text(1.00, 1.04, '16', 'FontSize', 9)
  4 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by