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일

0 개 추천

theta=0:2*pi/100:2*pi;
x=cos(theta);
y=sin(theta);
plot(x,y)
Best wishes
Torsten.

댓글 수: 5

Xh Du
Xh Du 2017년 7월 6일
Hi Torsten,
Your code will plot the circle, but what is it to do with l2 norm?
Torsten
Torsten 2017년 7월 6일
The circle with radius 1 around the origin is the set of points with l2norm=1.
I thought that you tried to plot this set of points, didn't you ?
Best wishes
Torsten.
Xh Du
Xh Du 2017년 7월 6일
Thanks for your answer. What I'd like to understand is how to plot the circle from function x^2 + y^2 = 1.
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개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

2017년 7월 6일

댓글:

2017년 7월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by