Matlab 的动态曲线绘图

2023-05-16

Line Animations

动态曲线的绘制
 

This example shows how to create an animation of two growing lines. The animatedline function helps you to optimize line animations. It allows you to add new points to a line without redefining existing points.

接下的例子将展示如何生成有关两根动态的曲线动画。

1、使用了animateline 函数帮助我们生成动态曲线。

2、该例子可以使我们在不用修改原有的数据基础上添加新的数据。

Contents

内容
  • Create Lines and Add Points
  • 生成曲线和添加点
  • Query Points of Line
  • 线段上点队列的生成

Create Lines and Add Points

Create two animated lines of different colors. Then, add points to the lines in a loop. Set the axis limits before the loop so that to avoid recalculating the limits each time through the loop. Use a docid:matlab_ref.f56-719157 or drawnow limitrate command to display the updates on the screen after adding the new points.

生成两条不同颜色的曲线。在这之后,将点的运动添加至线段的循环当中。为了避免在循环中重复计算运算还有展示区间需要先设置图像的大小。

添加新的点后可以使用drawnow limitrate 命令展示数据的更新。

a1 = animatedline('Color',[0 .7 .7]);
a2 = animatedline('Color',[0 .5 .5]);%区分颜色'Color',[0 .7 .7]);
a2 = animatedline('Color',[0 .5 .5]);%区分颜色
axis([0 20 -1 1])%设置图像区间,由图可见0-20位横坐标,-1-1为纵坐标
x = linspace(0,20,10000);%x的区间设定%设置图像区间,由图可见0-20位横坐标,-1-1为纵坐标
x = linspace(0,20,10000);%x的区间设定
%y = linspace(x1,x2,n) generates n points. The spacing between the points is (x2-x1)/(n-1).X点的步进
for k = 1:length(x);
    % first line
    xk = x(k);%更新x坐标
    ysin = sin(xk);
    addpoints(a1,xk,ysin);%点的添加

    % second line
    ycos = cos(xk);
    addpoints(a2,xk,ycos);

    % update screen
    drawnow limitrate %命令
end

CreateLineAnimationOfStreamingDataExample_01.png

The animation shows two lines that grow as they accumulate data.

Query Points of Line

Query the points of the first animated line.

[x,y] = getpoints(a1);

x and y are vectors that contain the values defining the points of the sine wave.

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Matlab 的动态曲线绘图 的相关文章

  • 05_用户管理

    目录 一 用户及用户组存在的意义二 用户及用户组在系统中的存在方式三 用户切换01 用户查看02 用户切换 四 用户涉及到的系统配置文件01 etc passwd 02 etc group 03 etc skel 04 etc shadow
  • Java String匹配算法

    1 String匹配算法 在一个文本或者较长的一段字符串中 xff0c 找出一个指定字符串 xff0c 并返回其位置 指定一个父类AbstractMatch xff0c 使用matchAtPosition String int 查看是否匹配
  • pycharm从远程仓库clone时“Authentication failed for '仓库地址'”的问题解决

    背景 xff1a 使用pycharm Git clone 时 xff0c 输错了账户名 xff0c 提示 Authentication failed for 39 仓库地址 39 xff0c 但pycharm将错误的账户名保存了 xff0c
  • windows10安装docker的若干坑--Docker Desktop requires Windows 10 Pro/Enterprise (15063+)

    安装docker for windows时报错 xff1a Docker Desktop requires Windows 10 Pro Enterprise 15063 43 or Windows 10 Home 19018 43 原因
  • sklearn接口报错Input contains NaN, infinity or a value too large for dtype(‘float64‘)

    1 错误场景 某个包调用了sklearn接口 xff0c 在fit x y 时报错Input contains NaN infinity or a value too large for dtype 39 float64 39 2 错误原因
  • 在shell中执行conda activate报错:Your shell has not been properly configured to use ‘conda activate‘.

    今天想要在Mac上执行一段自动启动jupyter的shell脚本 xff0c 但是出现了错误 错误代码 xff1a CommandNotFoundError Your shell has not been properly configur
  • centos7安装CUDA11.2+CUDNN8.1+tensorflow2.4

    环境 xff1a 系统 xff1a centos7 CPU xff1a Intel R Xeon R Gold 5220 CPU 64 2 20GHz 36核 GPU xff1a Tesla V100 4 查看CPU信息 xff1a cat
  • 开源时序建模框架Kats

    KATS简介 时间序列分析建模是数据科学和机器学习的一个重要的领域 xff0c 在电子商务 金融 供应链管理 医学 气象 能源 天文等诸多领域有着广泛的应用 目前时间序列分析以及建模的技术非常多 xff0c 但相对散乱 Facebook开源
  • 包含动画的PPT转为PDF

    目的 xff1a 带动画的PPT转化为PDF xff0c PDF的每一页是动画的一个步骤 方法 xff1a 使用 宏 参考链接 xff1a https www codercto com a 70548 html 具体方法 xff08 win
  • windows中docker编写一个dockerfile文件

    Dockerfile文件描述了当我们启动镜像的时候需要哪些软件元素 除了软件元素之外 xff0c Dockerfile 还能够让我们能够在启动镜像的时候在容器中运行一些命令或者指明我们使用什么样的环境 使用虚拟机中的vim命令编写docke
  • spyder增加模块代码提示功能

    最近在配置tensorflow xff0c 可是发现使用spyder的时候无法加载tensorflow的代码提示 xff0c 需要自己输入完整的函数名称 xff0c 十分不方便 xff0c 于是从网上找了一些资料 xff0c 来解决spyd
  • conda activate报错:gbk相关错误

    使用conda create n 建立新的虚拟环境后 xff0c 使用activate无法进入虚拟环境 xff0c 报了一个和gbk相关的错误 xff0c 后来经排查发现 xff0c 是系统环境变量中包含中文字符 xff0c 把系统变量中所
  • scanf源码分析

    本文分析的是glibc2 31中的scanf相关源码 xff0c 目的不是研究scanf的算法 xff0c 而是说明scanf在IO attack中的利用方法 xff0c 属于CTF的范畴 scanf c 其实就是对 vscanf inte
  • windows建立定时任务执行bat脚本

    在Linux中我们可以通过crontab来定时执行脚本 xff0c 那么windows中如何执行呢 xff1f 为了避免分支冲突 xff0c 准备在每天上班的时候自动将git远程仓库的最新版本pull下来 xff0c 然后在下班时间自动将重
  • 需账号密码登陆的网页爬虫

    对于普通网页的爬取十分简单 xff0c 如果网站没有任何反爬机制 xff0c 只要以下代码就可以实现对于网页的爬取 span class token keyword import span requests html span class
  • sqlserver通过OPENJSON转换 json数据

    OPENJSON 行集函数可将 JSON 文本转换为一组行和列 使用 OPENJSON 将 JSON 集合转换为行集后 xff0c 可以在返回的数据上运行任意 SQL 查询或将其插入到 SQL Server 表中 OPENJSON 函数采用
  • [linux]armbian修改为清华源

    查看系统发行版本 命令lsb release a 本机为基于Debian的armbian buster 所以用清华Debian源 修改apt为清华软件源 备份原文件 sudo cp etc apt sources list etc apt
  • 基础的三角函数,反三角函数,双曲函数的图形绘制(matlab)

    matlab基本图形绘制 基础的三角函数 xff0c 反三角函数 xff0c 双曲函数的图形绘制 xff1b 在此过程 xff0c 可以熟悉基础的matlab指令 xff1b 三角函数 y1 61 sin x y2 61 cos x y3
  • tkinter实现带背景图片的登录窗口

    实现功能 xff1a 打开系统登录窗口 xff0c 输入用户名密码 xff0c 点击登录后跳转到程序主界面 xff0c 用户名密码在程序代码里 xff0c 注意运行时需要自己准备一张背景图片back png 主要代码 xff1a self
  • CCF 201809-3 2018年9月第三题元素选择器(python 100分题解)

    问题描述 试题编号 xff1a 3试题名称 xff1a 元素选择器时间限制 xff1a 10 0s内存限制 xff1a 512 0MB问题描述 xff1a 提交后100分代码 xff1a 注意标签选择器大小写不敏感 xff0c 匹配时都转成

随机推荐