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
10 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Sam Chak
on 29 Sep 2023
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 Comments
Sam Chak
on 29 Sep 2023
Has your problem been solved? If so, could you please run the code and share the square plot here?
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!