二维绘图

plot

function epx_plt1years=1994:2000;income=[8 12 20 22 18 24 27];plot(years,income,'--r<','linewidth',2,'markersize',12,'markerfacecolor','w','markeredgecolor','b')
end%%linewidth:线宽
%%markersize:节点大小
%%markeredgecolor:节点边缘颜色
%%markerfacecolor:节点填充颜色
%
节点类型:
+:加号
o:圆
*:星号
.:点
x:叉号
^:正三角形
v:倒三角形
s:四边形
d:菱形
p:五边形
h:六边形
<:左三角形
>:右三角形
%%
线型类型:
-:实线
--:虚线
::点式虚线
-.:点线虚线
r:红色
g:绿色
b:黑色
y:黄色
k:黑色
w:白色
%

hold on/hold off

x=-2:0.01:4;
y=3*x.^3-26*x+6;
y2=9*x.^2-25;
y3=17*x;plot(x,y,'-b');
hold on;
plot(x,y2,'--g');
plot(x,y3,'-.r');
hold off;%%hold on 表示继续在该图中绘制%%也可以使用line(x,y)进行绘制,它使用向量 x 和 y 中的数据在当前坐标区中绘制线条

图的标注

%xlabel('text'):x轴标签
%ylabel('text'):y轴标签
%title('text'):标题
%text(x,y,'text'):指定位置的文字
%gtext('text'):图内某位在写入文字
%legend('str1','str2','str3',...,pos):图例区分%其中pos可以取:
%-1:图例外,置于右侧
%0:图例内,置于最佳位置
%1:右上;2:左上;3:左下;4:右下x=10:0.1:22;
y=95450./x.^2;
x2=10:2:22;
y2=[950 640 460 340 250 180 140];
plot(x,y,'-','linewidth',1)
xlabel('Distance(cm)')
ylabel('Intensity(lux)')
title('','fontsize',14);
axis([8 24 0 1200]);%%    axis([xmin,xmax,ymin,ymax])用于设定坐标轴范围text(14,700,'Comparison between theory and experiment.','edgecolor','r','linewidth',2);hold on
plot(x2,y2,'ro--','linewidth',1,'markersize',10);
legend('Theory','Experiment');
hold off;

特殊符号的输入

\alpha
\beta
\gamma
\theta
\pi
\sigma
\phi
\Delta
\Gamma
\Lambda
\Omega
\Sigma

对数坐标轴:semilogx(x,y)

figure
x=linspace(0.1,60,1000);
y=2.^(-0.2*x+10);
plot(x,y);figure
semilogx(x,y);

 errorbar

x=10:2:22;
y=[950 640 460 340 250 180 140];
err=[30 20 18 34 21 32 12];
errorbar(x,y,err);
xlabel('Distance(cm)');
ylabel('Intensity(lux)');

直方图:bar(x,y),barh(x,y)

x=1988:1994;
sle=[8 12 20 22 18 24 27];
figure
bar(x,sle,'r');
xlabel('Year');
ylabel('Sales');figure
barh(x,sle,'b');
xlabel('Year');
ylabel('Sales');

饼状图:pie(x)

g=[11 18 26 9 5];
pie(g);
title('Class Grades');

阶梯图stairs(x,y)

x=1988:1994;
sle=[8 12 20 22 18 24 27];
stairs(x,sle);

火柴图:stem(x,y)

x=1988:1994;
sle=[8 12 20 22 18 24 27];
stem(x,sle);

统计直方图histogram(y,n)

y=[58 43 44 55 67 55 44 56 66 76 98 76 55 34 56 76 87 89 78 67 54 56 78 90 87 99 75 56 87];
histogram(y,8);

极坐标图:polarplot(t,r)

t=linspace(0,2*pi,200);
r=3*cos(0.5*t).^2+t;
polarplot(t,r);

子图:subplot()

x = 0:0.2:10;
y1 = x.^2;
y2 = x.^3;
y3=x.^4;
y4=x;
subplot(2,2,1)
plot(x,y1)
subplot(2,2,2);
plot(x,y2)
subplot(2,2,3);
plot(x,y3);
subplot(2,2,4);
plot(x,y4);

clc
clear
syms t Px Py Pz;
R=400;r=100;l1=300;l2=1050;
alpha1=(1-1)*2*pi/3-pi/6;
alpha2=(2-1)*2*pi/3-pi/6;
alpha3=(3-1)*2*pi/3-pi/6;Px=0.1*sin(2*pi*t);
Py=0.1*cos(2*pi*t);
Pz=-0.72;
theta1=zeros(1,100);
theta2=zeros(1,100);
theta3=zeros(1,100);Px=800*sin(2.5*pi*t);Py=800*cos(2.5*pi*t);Pz=-750;D1=2*l1*((Px+r*cos(alpha1)-R*cos(alpha1))*cos(alpha1)+(Py+r*sin(alpha1)-R*sin(alpha1))*sin(alpha1));D2=2*l1*((Px+r*cos(alpha2)-R*cos(alpha2))*cos(alpha2)+(Py+r*sin(alpha2)-R*sin(alpha2))*sin(alpha2));D3=2*l1*((Px+r*cos(alpha3)-R*cos(alpha3))*cos(alpha3)+(Py+r*sin(alpha3)-R*sin(alpha3))*sin(alpha3));E1=2*l1*Pz;E2=2*l1*Pz;E3=2*l1*Pz;F1=((Px+r*cos(alpha1)-R*cos(alpha1)))^2+((Py+r*sin(alpha1)-R*sin(alpha1)))^2+Pz^2+l1^2-l2^2;F2=((Px+r*cos(alpha2)-R*cos(alpha2)))^2+((Py+r*sin(alpha2)-R*sin(alpha2)))^2+Pz^2+l1^2-l2^2;F3=((Px+r*cos(alpha3)-R*cos(alpha3)))^2+((Py+r*sin(alpha3)-R*sin(alpha3)))^2+Pz^2+l1^2-l2^2;theta1=2*atan((-E1-sqrt(E1^2-F1^2+D1^2))/(F1+D1));theta2=2*atan((-E2-sqrt(E2^2-F2^2+D2^2))/(F2+D2));theta3=2*atan((-E3-sqrt(E3^2-F3^2+D3^2))/(F3+D3));atheta1=diff(theta1,t);atheta2=diff(theta2,t);atheta3=diff(theta3,t);t=1:0.01:2;atheta1=eval(atheta1);
atheta2=eval(atheta2);
atheta3=eval(atheta3);theta1=eval(theta1);
theta2=eval(theta2);
theta3=eval(theta3);subplot(1,3,1)
hold on
plot(t,atheta1,'r','linewidth',1.5);
plot(t,atheta2,'--g','linewidth',1.5);
plot(t,atheta3,':b','linewidth',1.5);
hold off
legend('atheta1','atheta2','atheta3')
ylabel('主动臂角速度rad/s^2');
xlabel('时间t/s');
title('主动臂角速度随时间的变化关系');
grid onsubplot(1,3,2)
hold on
plot(t,theta1,'r','linewidth',1.5);
plot(t,theta2,'--g','linewidth',1.5);
plot(t,theta3,':b','linewidth',1.5);
hold off
legend('theta1','theta1','theta1')
ylabel('主动臂转角rad');
xlabel('时间t/s');
title('主动臂转角随时间的变化关系');
hold off
grid onsubplot(1,3,3)
hold on
plot(t,800*sin(2.1*pi*t),'r','linewidth',1.5);
plot(t,800*cos(2.1*pi*t),'--g','linewidth',1.5);
hold off
legend('Px','Py')
ylabel('末端位置Px/Py');
xlabel('时间t/s');
title('末端位置Px/Py随时间的变化关系');
hold off
grid on

学习笔记-Matlab二维绘图相关推荐

  1. python做直方图-python OpenCV学习笔记实现二维直方图

    本文介绍了python OpenCV学习笔记实现二维直方图,分享给大家,具体如下: 官方文档 – https://docs.opencv.org/3.4.0/dd/d0d/tutorial_py_2d ...

  2. MATLAB二维绘图(二)向图中添加标题,坐标轴,图标和文字信息

    MATLAB二维绘图(二)向图中添加标题,坐标轴,图标和文字信息 1.添加标题.图例.x轴信息和y轴信息,示例: %% 添加标题 clear; clc; close all; x = 0:0.1:2* ...

  3. matlab二维绘图部分

    matlab二维绘图部分 X,Y是向量,分别表示点集的横坐标和纵坐标 PLOT(X,Y,S) 符号函数(显函数.隐函数和参数方程)画图 (1) ezplot ezplot('f(x)',[a,b]) ...

  4. Matlab 二维绘图函数(plot类)

    plot 功能 绘制二维图形的最基本函数. 语法 //x为向量时,以x的元素值为纵坐标,x的序号为横坐标绘制曲线. //x为矩阵时,以其序号为横坐标,按列绘制每列元素值相对于其序号的曲线. polt( ...

  5. Matlab二维绘图---plot函数详解

     plot函数是matlab中最主要的二维作图函数.(参考文献--MATLAB HELP 文档) 一.常用的函数主要的形式有以下几种: plot(X,Y) plot(X,Y,LineSpec) p ...

  6. opencv 学习笔记五 二维离散卷积

    卷积的用途: 卷积主要用于降噪处理,是降噪处理的一种方式: 二维离散卷积包含高斯滤波,平滑滤波,中值滤波,以及能保证图像边缘的双边滤波和导向滤波算法等: 一.了解噪声的来源以及噪声的分类: 图像中难免 ...

  7. C语言学习笔记 (005) - 二维数组作为函数参数传递剖析

    前言 很多文章不外乎告诉你下面这几种标准的形式,你如果按照它们来用,准没错: //对于一个2行13列int元素的二维数组 //函数f的形参形式 f(int daytab[2][13]) {...}// ...

  8. threejs 形状几何体_ThreeJS学习笔记(五)——二维几何体元素及穿梭动画

    二维几何体 ThreeJS可以创建三种二维几何体,包括CircleGeometry(圆形),PlaneGeometry(矩形),ShapeGeometry(自定义形状). 创建二维几何体和创建三维几何 ...

  9. Matlab二维绘图

    1.画图plot 当需要画连续函数时,可以用fplot函数,当需要画符号函数时,可以用ezplot函数. 极坐标时可以用polar函数,对数坐标用semilogy函数,双对数用loglog函数,双y坐 ...

  10. 【Python学习】 - Matplotlib二维绘图 - plt.matshow()和plt.imshow()区别对比

    给定一个8*8的数据,用两种方式分别进行输出. xx = np.zeros((8,8),dtype = np.uint8) xx[0,0] = 13im = Image.fromarray(xx) p ...

最新文章

  1. 如何利用Python网络爬虫爬取微信朋友圈动态--附代码(下)
  2. Synchronize对象改变
  3. 京东三级列表页持续架构优化—Golang+Lua(OpenResty)最佳实践
  4. 设计模式(一)----单例模式
  5. [Hadoop]-YARN-伪分布式部署-hadoop-2.6.0-cdh5.7.0
  6. 大话“用户注册激活,忘记密码”发送邮件功能
  7. 博弈——通过博弈思想解决的问题(hdu1847,2147)
  8. Hyperledger Fabric Membership Service Providers (MSP)——成员服务
  9. python换行输出三个数中最大数_关于Python 3中print函数的换行详解
  10. Spark 任务参数配置
  11. JVM上篇:内存与垃圾回收
  12. 2019寒假·纪中记Day0-Day3
  13. autojs版本的QQ聊天自动回复机器人源码免费分享,不需要root权限
  14. 简明扼要理解YOLO v3
  15. Redis的应用场景
  16. 详解熵、最大熵、联合熵和条件熵、相对熵以及互信息之间的关系
  17. java 实现导出excel模板
  18. html背景视频模糊效果,视频背景如何模糊效果 ae视频模糊效果怎么做
  19. java 双屏显示_Android双屏异显的实现
  20. 扬州首套旅游数字藏品“扬州园林”,打造数字化元宇宙城市名片

热门文章

  1. 腾讯云服务器SSH密匙登录教程
  2. 软件测试技术课后习题:第1章软件测试概述-广东高等教育出版社,主编杨胜利
  3. 企业邮箱哪个好,邮箱品牌介绍—TOM邮箱
  4. 1秒等于1000毫秒, 1毫秒等于1000微秒,1微秒等于1000纳秒
  5. Java枚举(enum)
  6. arcgis style样式表文件转换成geoserver sld文件
  7. geoserver中sld设置
  8. Intel出品开源图片标注工具CVAT在Ubuntu18.04上部署
  9. 生日快乐程序_7天获客6万,小程序助力品牌对抗“行业寒冬”
  10. html中创建圆点列表符号,圆点项目符号