Home  >  Article  >  Computer Tutorials  >  Using Matlab to realize polar coordinate representation of matrix

Using Matlab to realize polar coordinate representation of matrix

WBOY
WBOYforward
2024-01-23 12:00:06769browse

Using Matlab to realize polar coordinate representation of matrix

How to express the matrix in polar coordinates in matlab

x=imread('greyleveal.bmp');

figure;

imshow(x);

X=abs(fftshift(fft2(x)));

figure;

imshow(X);

temp1=min(min(X))

X=X-temp1;

X=X./(max(max(X))/256);

figure;

imshow(X);

If you want to know the phase, replace the abs above with angle

-----------------------------

I=imread('11.jpg');

O=rgb2gray(I);

f1=abs(fftshift(fft2(O)));

temp1=min(min(f1));

f1=f1-temp1;

f1=f1./(max(max(f1))/256);

figure;

imshow(f1);

It is enough to output this image. . . . . .

After doing fft transformation, the result is a complex matrix.

[1 2i 3 4i

5 6i 7 8i]

You can display "a single point" on polar coordinates. Or all points are displayed on a polar coordinate at the same time (that can only be confusing points, and you don’t know who is who). I think this makes no sense at all.

The complex matrix actually only provides two pieces of information: one is the amplitude and the other is the phase. The program I gave can already display the amplitude. Generally this level is enough. If you want to display phase, rename abs to angle.

I want to draw a three-dimensional rectangle in matlab. X coordinate 2 2 Y coordinate 2 2 Z coordinate

1. The most basic function for drawing two-dimensional curves plot

2. Double ordinate function plotyy

3.

Coordinate control

The calling format of the function is:

axis([xmin xmax ymin ymax zmin zmax])

The axis function is rich in functions and commonly used uses include:

axis equal The vertical and horizontal axes use equal length scales

axis square generates a square coordinate system (default is rectangular)

axis auto Use default settings

axis off Cancel the coordinate axis

axis on display coordinate axis

The grid on/off command controls whether to draw grid lines or not. The grid command without parameters switches between the two states.

The box on/off command controls whether to add a border line or not. The box command without parameters switches between the two states.

4. Division of graphics window

The calling format of the subplot function is:

subplot(m,n,p)

5. Other functions for drawing two-dimensional graphics

1. Other forms of linear rectangular coordinate diagrams

In the linear rectangular coordinate system, other forms of graphics include bar charts, ladder charts, rod charts, filled charts, etc. The functions used are:

bar(x,y,option)

stairs(x,y,option)

stem(x,y,option)

fill(x1,y1,option 1,x2,y2,option 2,…)

6.Polar coordinate chart

The polar function is used to draw polar coordinates, and its calling format is:

polar(theta,rho,option)

Theta is the polar angle in polar coordinates, rho is the vector diameter in polar coordinates, and the content of the options is similar to the plot function.

7. Logarithmic coordinate graph

MATLAB provides functions for drawing logarithmic and semi-logarithmic coordinate curves. The calling format is:

semilogx(x1,y1, option 1, x2, y2, option 2,...)

semilogy(x1,y1, option 1, x2, y2, option 2,...)

loglog(x1,y1, option 1, x2, y2, option 2,...)

8. Drawing function for function adaptive sampling

The calling format of the fplot function is:

fplot(fname,lims,tol,options)

9. The most basic function for drawing three-dimensional curves

The plot3 function is very similar to the plot function. Its calling format is:

plot3(x1,y1,z1, option 1,x2,y2,z2, option 2,…,xn,yn,zn, option n)

10. Three-dimensional surface

1. Generation of plane grid coordinate matrix

(1) Generated using matrix operations.

x=a:dx:b; y=(c:dy:d)';

X=ones(size(y))*x;

Y=y*ones(size(x));

(2) Generate using meshgrid function.

x=a:dx:b; y=c:dy:d;

[X,Y]=meshgrid(x,y);

10. Functions for drawing three-dimensional surfaces

The calling format of surf function and mesh function is:

mesh(x,y,z,c)

surf(x,y,z,c)

Standard three-dimensional surface

The calling format of sphere function is:

[x,y,z]=sphere(n)

The calling format of cylinder function is:

[x,y,z]=sphere(R,n)

MATLAB also has a peaks function, called the multimodal function, which is often used for the demonstration of three-dimensional surfaces.

11.Other three-dimensional graphics

Special graphics such as bar charts, pie charts, and filled charts can also appear in three-dimensional form. The functions used are bar3, pie3, and fill3 respectively. In addition, there are contour plots of three-dimensional surfaces. Contour maps are divided into two-dimensional and three-dimensional forms, which are drawn using the functions contour and contour3 respectively.

How to use matlab to generate a random three-dimensional coordinate

Paid content is free to view for a limited time

answer

Hello, I am inquiring about relevant information and will reply to you immediately!

Hello, I am honored to help you answer - 1. First open the matla software and prepare the data for the three-dimensional diagram, including XYZ and attribute data. 2. Determine the interval between each point according to the data distribution, and use the griddata command to interpolate the attribute data. This is only an example, we use the default interpolation method. 3. Then you can try to use the plot3 command, and you can see that the graph draws multiple lines in column units. Of course, if this is not the desired graphic, there are other commands you can use next. 4. Try the contour3 command first. This is the same as the contour command, but the contours generated are three-dimensional distributions. 5. The surf and surfc commands are explained below. The default commands are as follows: surf(xx,yy,zz),figure,surfc(xx,yy,zz). 6. Of course, we can also process the image a little. Let's take the image generated by surf as an example. You can add the map name and xyz coordinate attributes to it: title ('depth map'); xlabel ('longitude'); ylabel ('latitude'); zlabel ('depth'). 7. Remove the lines in the image: surf(xx,yy,zz,'linestyle','none'). You can also use the following command to determine the number of color bars. You can refer to the following link here, whose properties are basically the same. 8. After removing the coordinate axis, you can finally get the following figure. Of course, you can also use the rotation command to adjust it to a suitable angle for display. [Hope the answer is helpful to you, dear]

The above is the detailed content of Using Matlab to realize polar coordinate representation of matrix. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete