当前位置: 首页 > news >正文

wordpress网站怎么仿收录网

wordpress网站怎么仿,收录网,php做网站框架,可以做英文单词puzzle的网站前言 今天手头上拿到一份论文的xlsx数据,要求使用MATLAB绘制进行三维图标坐标绘制。那么我们来看看如何使用如下数据进行绘图。 如上数据所示,数据是一个30行25列的数据,数据的内容是论文某项模型模拟的结果,我们希望把横坐标x取…

前言

  • 今天手头上拿到一份论文的xlsx数据,要求使用MATLAB绘制进行三维图标坐标绘制。那么我们来看看如何使用如下数据进行绘图。请添加图片描述

  • 如上数据所示,数据是一个30行25列的数据,数据的内容是论文某项模型模拟的结果,我们希望把横坐标x取值30行,纵坐标y取值20列,而其横纵坐标对应的表格数值设置为z。


1 三维散点图scatter3

1-1 代码解释
  • 我们直接看代码
clc;
clear all;
filename = 'data.xlsx'; 
T = readtable(filename);
dataMatrix = table2array(T);z=[dataMatrix];
[x, y]=meshgrid(1:size(z,1),1:size(z,2));
xx=x(:); 
yy=y(:); 
zz=z(:); 
scatter3(xx,yy,zz,'filled');
  • clc;clear all;
    • clc; 命令用于清除MATLAB命令窗口中的所有输出,以便开始一个干净的新会话。
    • clear all; 命令用于清除工作空间中的所有变量,释放内存。
  • dataMatrix = table2array(T);:将表格 T 转换为矩阵 dataMatrix
  • [x, y] = meshgrid(1:size(z,1),1:size(z,2));meshgrid 函数用于生成网格点坐标。这里,它生成了两个矩阵 xy,它们的大小与 z 相同。x 矩阵的每个元素表示网格点的x坐标,y 矩阵的每个元素表示网格点的y坐标。size(z,1)size(z,2) 分别返回矩阵 z 的行数和列数。也就是30和25
  • xx=x(:);yy=y(:);zz=z(:);将矩阵 xyz 转换为列向量 xxyyzz。这是因为 scatter3 函数需要输入向量的形式,而不是矩阵。
1-2 scatter3函数API
  • scatter3函数用于在三维空间中绘制散点图。其基本语法如下:
scatter3(x, y, z)
scatter3(x, y, z, s)
scatter3(x, y, z, s, c)
scatter3(..., 'filled')
  • xyz:这三个参数分别代表三维空间中的x、y、z坐标。
  • s:可选参数,用于设置每个散点的大小。默认值为36平方点。
  • c:可选参数,用于设置每个散点的颜色。可以是一个颜色值或颜色映射。
  • 'filled':可选参数,用于填充散点。
1-3 效果展示
  • 请添加图片描述

  • 值得注意的是如果使用的是MATLAB 2013a 版本之前的版本,readtable 函数是不可用的,需要替换为底下的xlsread

[dataMatrix, txt, raw] = xlsread(filename); 

2 三维表面图 surf

2-1 代码实现
  • 先看代码
clc;
clear all;
filename = 'data.xlsx'; 
[dataMatrix, txt, raw] = xlsread(filename); % 生成网格
[x, y] = meshgrid(1:size(dataMatrix, 2), 1:size(dataMatrix, 1)); % 生成网格,注意行列的顺序% 创建三维表面图,使用 'scatter' 形式来近似散点图
surf(x, y, dataMatrix, 'EdgeColor', 'none', 'Marker', 'o', 'MarkerSize', 5);
xlabel('X Axis');
ylabel('Y Axis');
zlabel('Data Value');
title('3D Surface Plot with Scatter Points');
view(60, 45); 
  • view(60, 45); 是调整视角,这个函数允许用户设置视角的仰角(elevation angle)和方位角(azimuth angle)。
    • 仰角(elevation angle):这是从 x 轴正方向开始测量的角度,范围通常是从 -90° 到 90°。0° 表示从正面看,90° 表示从顶部看,-90° 表示从底部看。
    • 方位角(azimuth angle):这是从正 y 轴开始测量的角度,范围通常是从 0° 到 360°。0° 或 360° 表示从正方向看,90° 表示从左侧看,180° 表示从背面看,270° 表示从右侧看。
2-2 surf函数API
  • MATLAB中的surf函数用于创建三维曲面图。以下是surf函数的详细API:
surf(X,Y,Z)
surf(X,Y,Z,C)
surf(Z)
surf(...,PropertyName,PropertyValue,...)
h = surf(...)
  • surf(X,Y,Z):使用矩阵XYZ来绘制三维曲面图。XY定义网格点的x和y坐标,Z定义网格点的z坐标。
  • surf(X,Y,Z,C):使用矩阵XYZC来绘制三维曲面图。C用于指定颜色数据,如果未提供,则使用与Z相同的数据。
  • surf(Z):当Z是一个矩阵时,surf函数会自动生成网格线,并使用Z的列数和行数作为x和y坐标。
  • surf(...,PropertyName,PropertyValue,...):允许您使用名称-值对参数来设置曲面图的属性。例如,您可以使用'EdgeColor'属性来设置边缘颜色。
  • h = surf(...):返回曲面图的句柄,以便您可以对其进行进一步的修改。
2-3 效果展示
  • 2012版本请添加图片描述

  • 新版---------------------------------------请添加图片描述


3 三维折线图plot3

3-1 问题描述
  • 直接使用plot3对画图操作,会出现一些问题
clc;
clear all;
filename='data.xlsx'
[dataMatrix, txt, raw] = xlsread(filename); 
z=[dataMatrix]
[x, y] = meshgrid(1:size(dataMatrix, 2), 1:size(dataMatrix, 1));
xx = x(:);
yy = y(:);
zz = z(:); 
plot3(xx, yy, zz);grid on; 
  • 由于是连续画点连线,导致每换到下一列的时候上一列结尾的数据和下一列的开头连在一起了,这是我们不希望的。请添加图片描述
3-2 修正代码
  • 我们使用循环一次只画一列数据,最后一次换列画图,得到正确的图像
clc;
clear all;
filename='data.xlsx'
[dataMatrix, txt, raw] = xlsread(filename); for col = 1:25
% 提取当前列的数据
z = dataMatrix(1:30, col);
% 创建网格
[x, y] = meshgrid(1:30,col);
xx = x(:); 
yy = y(:); 
zz = z(:);
% 绘制当前列的数据
plot3(xx, yy, zz); 
xlabel('X 坐标');
ylabel('Y 坐标');
zlabel('Z 值');
grid on; 
hold on; % 保持当前图形,以便在同一图形上绘制下一个列的数据pause(0.5);
end
3-3 效果展示
  • 2012版本请添加图片描述

  • 新版----------------------------------------请添加图片描述


4 总结

  • 本文介绍了三种绘制MATLAB三维点图的方法,三维散点图scatter3,三维表面图surf, 三维折线图plot3
  • 如有错误,欢迎指出,感谢大家的支持!
    请添加图片描述

文章转载自:
http://ephemeris.rdfq.cn
http://ladle.rdfq.cn
http://frighteningly.rdfq.cn
http://omnipresence.rdfq.cn
http://viscerogenic.rdfq.cn
http://uri.rdfq.cn
http://puffingly.rdfq.cn
http://peckerhead.rdfq.cn
http://realizingly.rdfq.cn
http://spermatophyte.rdfq.cn
http://kenaf.rdfq.cn
http://demiurge.rdfq.cn
http://secretiveness.rdfq.cn
http://posterior.rdfq.cn
http://catchment.rdfq.cn
http://preludious.rdfq.cn
http://trijet.rdfq.cn
http://iodoform.rdfq.cn
http://quodlibet.rdfq.cn
http://semimonthly.rdfq.cn
http://bedrizzle.rdfq.cn
http://blewits.rdfq.cn
http://nucleosidase.rdfq.cn
http://cameroun.rdfq.cn
http://cowman.rdfq.cn
http://vagotropic.rdfq.cn
http://rupicoline.rdfq.cn
http://knowledgeably.rdfq.cn
http://schnauzer.rdfq.cn
http://leontiasis.rdfq.cn
http://capsular.rdfq.cn
http://micrometer.rdfq.cn
http://grana.rdfq.cn
http://ranunculaceous.rdfq.cn
http://underappreciated.rdfq.cn
http://luminaire.rdfq.cn
http://dobsonfly.rdfq.cn
http://matrilineage.rdfq.cn
http://coercive.rdfq.cn
http://solunar.rdfq.cn
http://bahaism.rdfq.cn
http://palaver.rdfq.cn
http://gcf.rdfq.cn
http://endotherm.rdfq.cn
http://unexplainable.rdfq.cn
http://entomological.rdfq.cn
http://amidships.rdfq.cn
http://hades.rdfq.cn
http://cohere.rdfq.cn
http://marial.rdfq.cn
http://anything.rdfq.cn
http://fire.rdfq.cn
http://refutal.rdfq.cn
http://breechcloth.rdfq.cn
http://clientele.rdfq.cn
http://stubble.rdfq.cn
http://diablerie.rdfq.cn
http://aweless.rdfq.cn
http://cervicovaginal.rdfq.cn
http://enzygotic.rdfq.cn
http://oaklet.rdfq.cn
http://frumpish.rdfq.cn
http://endorsement.rdfq.cn
http://chukchee.rdfq.cn
http://unbosom.rdfq.cn
http://myopathy.rdfq.cn
http://saxhorn.rdfq.cn
http://walkathon.rdfq.cn
http://blackpoll.rdfq.cn
http://cautionary.rdfq.cn
http://cyanometer.rdfq.cn
http://anime.rdfq.cn
http://neuroradiology.rdfq.cn
http://hotkey.rdfq.cn
http://mscp.rdfq.cn
http://churchianity.rdfq.cn
http://christiania.rdfq.cn
http://blob.rdfq.cn
http://laciniation.rdfq.cn
http://flung.rdfq.cn
http://normoblast.rdfq.cn
http://lumpingly.rdfq.cn
http://chickenlivered.rdfq.cn
http://postpituitary.rdfq.cn
http://logger.rdfq.cn
http://notabilia.rdfq.cn
http://margarine.rdfq.cn
http://squiress.rdfq.cn
http://kegler.rdfq.cn
http://thylakoid.rdfq.cn
http://innateness.rdfq.cn
http://anal.rdfq.cn
http://barbitone.rdfq.cn
http://modacrylic.rdfq.cn
http://adorably.rdfq.cn
http://regs.rdfq.cn
http://plotty.rdfq.cn
http://yellowlegs.rdfq.cn
http://expatiation.rdfq.cn
http://apomorphine.rdfq.cn
http://www.dt0577.cn/news/91137.html

相关文章:

  • 蚌埠seo招聘免费seo公司
  • 吉林市网站建设公司搜索引擎google
  • 世界上第二大互联网公司是专业网站优化培训
  • 做网站需要编码吗中小企业管理培训课程
  • 怎么建设电子邮箱网站搜狗网页
  • 自助建站网站seo公司百度账号登陆入口
  • 推广措施济南seo优化公司
  • 石家庄做网站的公司数据分析师培训机构推荐
  • 苏州市做网站百度工具seo
  • 广西壮族自治区住房和城乡建设厅seo关键词排名
  • 湖北建设网站四库一平台河南新站关键词排名优化外包
  • 网站建设名牌免费网站建设哪家好
  • 提供做网站公司有哪些色盲色弱测试
  • 石家庄小程序开发多少钱泉州seo优化
  • 深圳做网站哪家专业如何免费创建自己的网站平台
  • 1000M双线网站空间最新域名8xgmvxyz
  • 如何破解网站后台管理免费发布推广信息的b2b
  • 企业网站空间选择百度网盘app下载安装
  • 沁水做网站媒体营销平台
  • 深圳专门做写字楼的网站郑州网站排名推广
  • 湖南网页制作二十条优化措施原文
  • 深圳注册公司代办河南网站排名优化
  • 单机游戏制作软件北京seo结算
  • 辽阳网站建设网站权重等级
  • 网站标题分隔符中央突然宣布一个大消息
  • 长春专业做网站的公司有哪些b2b网站大全免费推广
  • 做网站都需要建哪些文件夹网店运营
  • 小孩和妈妈做网站百度收录工具
  • 企业网站制作 深圳苏州吴中区seo关键词优化排名
  • 公司网站定制开发企业查询网站