当前位置:网站首页>Matlab draws radar chart (four lines of code)
Matlab draws radar chart (four lines of code)
2022-07-25 02:27:00 【Touch the sun with your feet】
Actually, the radar chart is quite simple ! Just four lines of code . Though very short , Because it is a single group of radar pictures , If you want to draw multiple groups of paintings , Write a hold on Just keep drawing .
Single group data radar chart :
data = [2000,10000,8000,10667,6250,8667,7500,6000];
lim = [0,10000;0,10000;0,10000;0,10000;0,10000;0,10000;0,10000;0,10000];% Range of each data
labels = {'1 Number ','2 Number ','3 Number ','4 Number ','5 Number ','6 Number ','7 Number ','8 Number '};% Name
draw_radar(data,lim,labels);Radar maps of multiple sets of data : If you want to distinguish easily , Just draw colors in the picture window by yourself , Mainly, I can't use color , Embarrassed .
data = [2000,10000,8000,10000,6250,8667,7500,6000];
lim = [0,10000;0,10000;0,10000;0,10000;0,10000;0,10000;0,10000;0,10000];% Range of each data
labels = {'1 Number ','2 Number ','3 Number ','4 Number ','5 Number ','6 Number ','7 Number ','8 Number '};% Name
draw_radar(data,lim,labels);
hold on
data = [3000,8000,7000,8000,7250,6667,7400,8000];
lim = [0,10000;0,10000;0,10000;0,10000;0,10000;0,10000;0,10000;0,10000];% Range of each data
labels = {'1 Number ','2 Number ','3 Number ','4 Number ','5 Number ','6 Number ','7 Number ','8 Number '};% Name
draw_radar(data,lim,labels);
Of course, there are functions , There is no need to understand , Anyway, you can't understand . On the last line draw_radar It's just a function . as follows : Remember to change the file name to draw_radar Oh , Otherwise, the program will not run .
Don't you like it in front of the screen ?
function draw_radar(data,lim,labels)
n=length(data);
adj_data=zeros(n,1);
point=zeros(n,2);
set(gca,'units','normal','pos',[0 0 1 1]);
axis off
axis equal
hold on
theta_last=pi/2;
for i=1:n
theta=2*pi/n*i+pi/2;
plot([0,500*cos(theta)],[0,500*sin(theta)],'k-','linewidth',2);
for j=1:5
plot([j*100*cos(theta_last),j*100*cos(theta)],[j*100*sin(theta_last),j*100*sin(theta)],'--','linewidth',0.75,'color',[0.5,0.5,0.5]);
end
theta_last=theta;
if data(i)<lim(i,1)
adj_data(i)=0;
elseif data(i)>lim(i,2)
adj_data(i)=500;
else
adj_data(i)=(data(i)-lim(i,1))/(lim(i,2)-lim(i,1))*500;
end
point(i,1:2)=[adj_data(i)*cos(theta);adj_data(i)*sin(theta)];
text_around(510*cos(theta),510*sin(theta),labels{i},theta);
end
for i=1:n
theta=2*pi/n*i+pi/2;
for j=1:5
text_around(j*100*cos(theta),j*100*sin(theta),num2str(lim(i,1)+(lim(i,2)-lim(i,1))/5*j),theta+pi/2,7);
end
end
plot([point(:,1);point(1,1)],[point(:,2);point(1,2)],'k-','linewidth',0.8);
fill(point(:,1),point(:,2),[0.9 0.9 0.7])
alpha(0.5);
texts=findobj(gca,'Type','Text');
minx=-300;
maxx=300;
miny=-300;
maxy=300;
for i=1:length(texts)
rect=get(texts(i),'Extent');
x=rect(1);
y=rect(2);
dx=rect(3);
dy=rect(4);
if x<minx
minx=x;
elseif x+dx>maxx
maxx=x+dx;
end
if y<miny
miny=y;
elseif y+dy>maxy
maxy=y+dy;
end
end
axis([minx-50,maxx+50,miny-20,maxy+20]);
end
function text_around(x,y,txt,theta,fontsize)
if nargin==4
fontsize=10;
end
section=mod(theta+pi/12,2*pi);
if section>pi+pi/6
if section>1.5*pi+pi/6
text(x,y,txt,'VerticalAlignment','cap','HorizontalAlignment','left','Fontsize',fontsize);
elseif section>1.5*pi
text(x,y,txt,'VerticalAlignment','cap','HorizontalAlignment','center','Fontsize',fontsize);
else
text(x,y,txt,'VerticalAlignment','cap','HorizontalAlignment','right','Fontsize',fontsize);
end
elseif section>pi
text(x,y,txt,'VerticalAlignment','middle','HorizontalAlignment','right','Fontsize',fontsize);
elseif section>pi/6
if section>0.5*pi+pi/6
text(x,y,txt,'VerticalAlignment','bottom','HorizontalAlignment','right','Fontsize',fontsize);
elseif section>0.5*pi
text(x,y,txt,'VerticalAlignment','bottom','HorizontalAlignment','center','Fontsize',fontsize);
else
text(x,y,txt,'VerticalAlignment','bottom','HorizontalAlignment','left','Fontsize',fontsize);
end
else
text(x,y,txt,'VerticalAlignment','middle','HorizontalAlignment','left','Fontsize',fontsize);
end
endExpand the :
radar , It's English Radar transliteration , From the radio detection and ranging Abbreviation , You mean for “ Radio detection and ranging ”, That is to use radio methods to find targets and determine their spatial position . therefore , Radar is also called “ Radio location ”. Radar is an electronic device that uses electromagnetic waves to detect targets . Radar emits electromagnetic wave to irradiate the target and receives its echo , Thus, the distance from the target to the electromagnetic wave emission point is obtained 、 The rate of distance change ( Radial velocity )、 bearing 、 Height, etc .
The emergence of radar , It is because during the first World War, when Britain and Germany were at war , Britain is in urgent need of a radar that can detect metal objects in the air ( technology ) It can help search for German aircraft in the anti air attack war . During the second world war , Radar has already appeared ground to air 、 air-to-ground ( Search for ) bombardment 、 Air to air ( Volley ) Fire control 、 Radar technology of IFF function .
After world war ii , Radar has developed monopulse angle tracking 、 Pulse Doppler signal processing 、 High resolution of synthetic aperture and pulse compression 、 Combined system combining IFF 、 Automatic fire control system combined with computer 、 Terrain avoidance and terrain following 、 Passive or active phase array 、 Frequency agility 、 New radar systems such as multi-target detection and tracking .
Later, with the scientific progress of microelectronics and other fields , The continuous development of Radar Technology , Its connotation and research content are constantly expanding . The detection method of radar has been developed from the former only radar detector to infrared light 、 ultraviolet 、 Laser and other optical detection means are integrated and coordinated .
The multi-function capability of contemporary radar makes battlefield commanders search in various ways / Scan the target in tracking mode , And automatically correct the interference error , And most of the control functions are completed inside the system .
Automatic target recognition can maximize the role of weapon systems , AWACS and JSTARS Such an integrated radar system with the ability to identify the enemy and me in the battlefield has actually become the information command center in the future battlefield .
application :
The advantage of radar is that it can detect long-distance targets day and night , And free from fog 、 Clouds and rain block , All weather 、 The characteristics of the whole day , And have a certain penetration ability . therefore , It has not only become an indispensable electronic equipment in military , And it is widely used in social and economic development ( Such as weather forecast 、 Resource exploration 、 Environmental monitoring, etc ) And scientific research ( Celestial research 、 Atmospheric physics 、 Research on ionospheric structure, etc ). Spaceborne and airborne synthetic aperture radar has become a very important sensor in remote sensing . Radar targeting the ground can detect the precise shape of the ground . Its spatial resolution can reach several meters to tens of meters , And it has nothing to do with distance . Radar is monitoring flood 、 Sea ice monitoring 、 Soil moisture survey 、 Forest resources inventory 、 Geological survey and other aspects also show good application potential .
边栏推荐
- Origin and development of philosophy Hegel external historical form
- When executing SQL query statements in MySQL database, the underlying implementation principle (ultra detailed)
- Digital commerce cloud fine chemical industry management platform integrated informatization solution
- [linear DP] Digital triangle
- Common functional interfaces_ Predicate interface_ Default method and and predicate interface exercise_ Set interface filtering
- Automatically create partition tables by time and month in PostgreSQL
- Detailed explanation of MySQL, Oracle and PostgreSQL database index failure scenarios
- When sharing a folder, the 'attempt to share xxxxx
- Peripherals: interrupt system of keys and CPU
- Vs2019 configuring Qt5 development environment
猜你喜欢

Is it necessary to increase the number of milliseconds and save several KB of memory in the program?

These 11 chrome artifacts are extremely cool to use

Using multithreaded execution method in Lua script based on nlua implementation

Win10 configuring CUDA and cudnn

Today in history: the kotlin language was published for the first time; The father of the IMAP agreement was born; CT imaging achieves a new breakthrough

Inventory of well-known source code mall systems at home and abroad

After working for two months in the summer vacation, I understood three routing schemes of keepalived high availability
Failed to create data snapshot: lock file [/siyuan/data/assets/image- 2022070216332-jijwccs.png failed: open /siyuan/data/assets/image- 2022070216332-jijwccs.png: permission denied; unable to lock fil

Let's customize the loader
![[leetcode] 3. Longest substring without repeated characters - go language problem solution](/img/63/57d3557d77d44b51b7d0f71669568f.png)
[leetcode] 3. Longest substring without repeated characters - go language problem solution
随机推荐
String class
Redis unauthorized access vulnerability recurrence (www.hetianlab.com)
Mobile Robotics (3) Kalman filter
Gerrit statistics script
Academicians said: researchers should also support their families. They can only do short-term and fast research if they are not promoted
Flutter apple native Pinyin keyboard input exception on textfield | Pinyin input process callback problem
Standard transfer function
Ten year structure and five-year Life-03 trouble as a technical team leader
H5 common positioning function package
[circular array] JS method collection of circular array
DNA helped solve the outstanding case 30 years ago. The suspect strangled his girlfriend because he fell in love with his roommate. He was already the CEO of the technology company when he was arreste
Hongmeng harmonyos 3 official announcement: officially released on July 27; Apple slowed down the recruitment and expenditure of some teams in 2023; Russia fined Google 2.6 billion yuan | geek headlin
C traps and defects Chapter 2 lexical "traps" 2.4 switch statements
Example demonstration of "uncover the secrets of asp.net core 6 framework" [02]: application development based on routing, MVC and grpc
Use Fiddler to capture apps
Why can't reading more books improve your writing?
Easy to master SSO single sign on, see this article
Completefuture parallel asynchronous return processing
Gbase 8s how to query relational databases in sentences to select sample syntax and results of data from complex types
Deep understanding of string class