当前位置:网站首页>Matlab map with color representation module value size arrow
Matlab map with color representation module value size arrow
2022-08-05 02:18:00 【zdlwhereyougo】
The quiver function that comes with matlab can draw arrow graphs. The length of the arrow corresponds to the magnitude of the modulus value of the vector.If you want to achieve the same length of arrows, first normalize the arrows, calculate the magnitude of the modulus of all arrows, calculate the scaling factor of each arrow, and then scale the vertical and horizontal components so that the modulus of all arrows are equal.Then divide the modulus value into 256 values from large to small, and use the colormap matrix that comes with matlab to color the arrows in turn.
Look directly at the image: the left is the original image, the right is the adjusted image
Source code:
clc;close all;clear ;% construct dataload('wind','x','y','u','v')X = x(11:22,11:22,1);Y = y(11:22,11:22,1);U = u(11:22,11:22,1);V = v(11:22,11:22,1);%% default drawingfigurequiver(X,Y,U,V,'r')%% adjust drawingM=sqrt(U.^2+V.^2);% Calculated moduluscolorlist=jet;% load the color bar, you can also replace other, cool, winter, etc.Mdown=min(M(:));Mup=max(M(:));Mlist=linspace(Mdown,Mup,256);scaler1=Mup./M;% length adjustment factorU=U.*scaler1;% Adjust each componentV=V.*scaler1;% Adjust each componentscaler2=0.05;% rescale the length to fit the drawingU=U*scaler2;V=V*scaler2;figure[m,n]=size(X);for i=1:mfor j=1:nMtemp=abs(M(i,j)-Mlist);index=find(Mtemp==min(Mtemp));colorarrow=colorlist(index,:);q =quiver(X(i,j),Y(i,j),U(i,j),V(i,j),'MaxHeadSize',100);% Draw each one separately and adjust the size of the arrowq.LineWidth=1;q.Color=colorarrow;hold onendendhc=colorbar;colormap(jet)hc.TickLabels=linspace(Mdown,Mup,11);边栏推荐
猜你喜欢

1349. 参加考试的最大学生数 状态压缩

【Word】Word公式导出PDF后出现井号括号#()错误

Opening - Open a new .NET modern application development experience

开篇-开启全新的.NET现代应用开发体验

在这个超连接的世界里,你的数据安全吗

Jincang database KingbaseES V8 GIS data migration solution (3. Data migration based on ArcGIS platform to KES)

Programmer's list of sheep counting when insomnia | Daily anecdote

Flink 1.15.1 集群搭建(StandaloneSession)

LPQ (local phase quantization) study notes

“嘀哩哩,等灯等灯”,工厂安全生产的提示音
随机推荐
直播预告|30分钟快速入门!来看可信分布式AI链桨的架构设计
Flink 1.15.1 集群搭建(StandaloneSession)
DAY22:sqli-labs 靶场通关wp(Less01~~Less20)
Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?
Domain Driven Design - MDD
[Unity Entry Plan] Handling of Occlusion Problems in 2D Games & Pseudo Perspective
Opening - Open a new .NET modern application development experience
CPDA|运营人如何从负基础学会数据分析(SQL)
"Dilili, wait for the lights, wait for the lights", the prompt sound for safe production in the factory
短域名绕过及xss相关知识
【日常训练】1403. 非递增顺序的最小子序列
Greenplum Database Fault Analysis - Can a Soft Connection Be Made to the Database Base Folder?
Greenplum Database Fault Analysis - Why Does gpstart -a Return Failure After Version Upgrade?
Log an error encountered when compiling google gn "I could not find a ".gn" file ..."
原生js实现多选框全部选中和取消效果
Greenplum数据库故障分析——版本升级后gpstart -a为何返回失败
[Word] #() error occurs after Word formula is exported to PDF
fragment可见性判断
【MySQL series】- Does LIKE query start with % will make the index invalid?
【LeetCode刷题】-数之和专题(待补充更多题目)