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

9 ビュー (過去 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 件のコメント
Muhideen Ogunlowo
Muhideen Ogunlowo 2023 年 9 月 29 日
I think the code is fine, I just didn't understand it at first
Sam Chak
Sam Chak 2023 年 9 月 29 日
Has your problem been solved? If so, could you please run the code and share the square plot here?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraph 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