フィルターのクリア

How to plot the l2 norm circle?

6 ビュー (過去 30 日間)
Xh Du
Xh Du 2017 年 7 月 6 日
コメント済み: Xh Du 2017 年 7 月 6 日
Hi all,
I'm trying to visualize the l2 norm circle. It seems easy but I'm stuck. This is the code I write to plot the circle (based on x^2 + y^2 = 1):
clear; clc;
x = -1:0.01:1;
y = sqrt(1 - x .^ 2);
plot(x, y)
hold on
plot(y, x)
axis square
It gives me a figure like this:
apparently the left lower part is missing, what I do not understand is that both x and y are non-negative, why would l2 norm gives a full circle where left lower part is negative for both x and y?
Please forgive me if I did not explain mathematically enough.

採用された回答

Torsten
Torsten 2017 年 7 月 6 日
theta=0:2*pi/100:2*pi;
x=cos(theta);
y=sin(theta);
plot(x,y)
Best wishes
Torsten.
  5 件のコメント
Torsten
Torsten 2017 年 7 月 6 日
clear;
clc;
x = -1:0.01:1;
y = sqrt(1 - x .^ 2);
plot(x, y)
hold on
plot(x, -y)
axis square
Best wishes
Torsten.
Xh Du
Xh Du 2017 年 7 月 6 日
Many thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by