Plot unit circle in chebychev metric in MATLAB

In summary, the conversation discusses attempting to plot the unit circle using the Chebychev metric in MATLAB. The code being used includes the 'pdist' and 'cmdscale' functions, which have been modified to fit the desired metric. However, there are two problems with the code. First, the 'y' variable has a size of 360x180 instead of the expected 2x2. Second, the resulting plot has rounded edges, indicating that the Manhattan metric is being used instead. The correct syntax is provided as a solution, which involves using the 'sqrt' function and calculating the eigenvalues and eigenvectors.
  • #1
meldraft
281
2
Ok, so I'm trying to plot the unit circle using the chebyvhev metric, which should give me a square. I am trying this in MATLAB, using the 'pdist' and 'cmdscale' functions. My uber-complex code is the following:

clc;clf;clear all;
boundaryPlot=1.5;

% Euclidean unit circle
for i=1:360
theta(i)=deg2rad(i);
end
zc=[cos(theta)' sin(theta)'];

% Transform to Chebychev metric
x=zc(:,:);
D=pdist(x,'chebychev');
D1=squareform(D);
y=cmdscale(D1);


% Plots
hold on
plot(y(:,1),y(:,2));
axis square;axis([-boundaryPlot boundaryPlot -boundaryPlot boundaryPlot])
plot([-boundaryPlot boundaryPlot],[0 0],'k')
plot([0 0],[-boundaryPlot boundaryPlot],'k')

where the part in bold is the really important part of the code. I have two problems with this. First, the 'y' variable which is supposed to hold the coordinates under the new metric has a size of 360x180. One of these dimensions should have been 2, which is the dimension of the L-p space (p=2).

My second problem is that I get the plot you can see in the attachment, which corresponds to the Manhatan metric, and has rounded edges for some reason.

Has anyone done this calculation before? Is there some other syntax/function I should be using??
 

Attachments

  • untitled.jpg
    untitled.jpg
    10.7 KB · Views: 540
Physics news on Phys.org
  • #2
The correct syntax should be:clc;clf;clear all;boundaryPlot=1.5;% Euclidean unit circlefor i=1:360 theta(i)=deg2rad(i);endzc=[cos(theta)' sin(theta)'];% Transform to Chebychev metricx=zc(:,:);D=pdist(x,'chebychev');D1=squareform(D);[V,L]=cmdscale(D1);y=V*sqrt(L);% Plotshold onplot(y(:,1),y(:,2));axis square;axis([-boundaryPlot boundaryPlot -boundaryPlot boundaryPlot])plot([-boundaryPlot boundaryPlot],[0 0],'k')plot([0 0],[-boundaryPlot boundaryPlot],'k')
 

1. What is a plot unit circle in Chebychev metric in MATLAB?

A plot unit circle in Chebychev metric in MATLAB is a graphical representation of a circle with a radius of 1, using the Chebychev metric, which is a mathematical concept used to measure the distance between two points in a space. It is created using MATLAB, a programming language commonly used in scientific and engineering applications.

2. How is the Chebychev metric different from other metrics?

The Chebychev metric differs from other metrics, such as the Euclidean metric, in that it measures the distance between two points in a straight line, regardless of the direction. This makes it useful for applications where the direction of movement is not important, such as in the plot of a circle.

3. What is the purpose of plotting a unit circle in Chebychev metric?

The purpose of plotting a unit circle in Chebychev metric is to visualize and understand the concept of the Chebychev metric and its properties. It can also be used to compare and contrast with other metrics, and to explore the behavior of different mathematical functions in relation to the circle.

4. How can I plot a unit circle in Chebychev metric in MATLAB?

To plot a unit circle in Chebychev metric in MATLAB, you can use the built-in functions "plot" and "circle". First, define the Chebychev metric using the "cheb" function, then use the "circle" function to create a circle with a radius of 1, and finally use the "plot" function to plot the circle on a graph.

5. Are there any applications for plotting a unit circle in Chebychev metric?

Yes, there are various applications for plotting a unit circle in Chebychev metric. Some examples include image processing, optimization problems, and control systems. In these applications, the Chebychev metric is used to measure the distance between two points and can help analyze and improve the performance of systems.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
939
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top