matlab
ooolmf
活着就是要拼搏
展开
-
2021-09-19matlab距离角度代码,俯仰扫描
clcclear close allsum=0;H0=input("输入垂直距离,单位mm");L0=input("输入水平距离,单位mm");N0=input("输入水平距离,数据个数");a(1)=atan(H0/L0);b(1)=a(1)*180/3.14159disp(a)for i=2:N0 sum=sum+a(i-1); a(i)=atan((i)*H0/L0)-sum; b(i)=a(i)*180/3.14159;enddisp(a);disp原创 2021-09-19 17:55:47 · 680 阅读 · 0 评论 -
plot 串口助手,DataScope软件的数据,导入matlab绘图。温度曲线
clc;clear;datatemp=importdata('T1200W100.csv'); %读取csv数据文件datatemp1=importdata('T1200W150.csv'); %读取csv数据文件for i=1:2:1214 x=datatemp1.data(1,i); y=datatemp1.data(2,i); axis([0 1300 25 165]); plot(x,y,'.b','linewidth',0.1); hold on;原创 2021-09-12 20:09:13 · 452 阅读 · 0 评论 -
2021-08-31matlab2019B --serial---DIYIMU06.m
%完成选择一个空的坐标轴、、、、202108301530%完成添加串口,读取yaw,pitch,roll三个角度,让坐标旋转;%暂时做一个轴的三个角度,帧格式:0x21,yaw,pitch,roll,0x0D,0x0A% Create a 3-D plotclcclear close allglobal RecData0;RecData0=0;global RecCount;%串口接收数据的数量,帧头等使用RecCount=0;ax = axes('XLim', [-5 5], '.原创 2021-08-31 10:12:21 · 387 阅读 · 0 评论 -
2021-08-30matlab2019b,,旋转物体,旋转矩阵。下次结合IMU进行旋转
%完成选择一个空的坐标轴、、、、% Create a 3-D plotax = axes('XLim', [-5 5], 'YLim', [-5 5], 'ZLim', [-5 5]);xlabel(ax, 'X-axis');ylabel(ax, 'Y-axis');zlabel(ax, 'Z-axis');% % Reverse the 2 axis directions to match the device coordinate system%set(ax, 'Zdir', 'rev.原创 2021-08-30 18:55:12 · 302 阅读 · 0 评论 -
matlab2019chuankou--stm32--(01
clcclearclose all f = figure; hx = animatedline('Color', 'r', 'LineWidth', 2); hy = animatedline('Color', 'g', 'LineWidth', 2); hz = animatedline('Color', 'b', 'LineWidth', 2); title('test Data v/s Time'); xlabel('Time (in s)'); ylabel(原创 2021-08-29 18:48:31 · 260 阅读 · 0 评论 -
matlab arduino serialport
Read Streaming Data from Arduino Using Serial Port CommunicationView MATLAB CommandThis example shows how to enable callbacks to read streaming ASCII terminated data from an Arduino® Due using the serialport interface.Load Program on the ArduinoPlug原创 2021-08-28 21:14:41 · 281 阅读 · 0 评论 -
matlab 2019 学习se
serialportConnection to serial portexpand all in pageDescriptionA serialport object represents a serial client for communication with the serial port. After creating the object, use dot notation to set its properties.CreationSyntaxs = serialport(port原创 2021-08-28 17:27:42 · 434 阅读 · 0 评论 -
2021-08-23matlab学习
1、十六进制转成十进制hex2dec.这个函数转换得到的是double类型的十进制;所以要转成uint8类型cc=hex2dec(‘5’)cc=5cc=hex2dec(‘A’)cc=10cc=hex2dec(‘a’)cc=10cc=hex2dec(‘a1’)cc=161161=10*16+12、matlab的数组,从下标1开始;而不是C语言的0开始。3、测试a(1,1)=‘a’;a(1,2)=‘b’;c=hex2dec(a);d=uint8©;上面例子中。c=171,是do原创 2021-08-27 16:38:24 · 342 阅读 · 0 评论 -
matlab2019B_serialport04,,,示波曲线
%matlab2019b串口功能%matlab:注意是2019B 版本;%数据格式,format%帧头'S'(十进制83)%+TleftdataH+TleftdataL+TrightdataH+TrightdataL%+ VleftDataH+VleftDataL+VrightDataH+VrightDataL%+角度左边数据H+角度左数据L+角度右边数据H+角度右边数据L%+csum%+0x0D(十进制13)%+0x0A(十进制10)%数据长度为16close all;clear原创 2021-06-26 16:07:17 · 362 阅读 · 0 评论 -
matlab2019Bserial代码和解读
%matlab2019b串口功能%matlab:注意是2019B 版本;%300,,,300/256=1 300%256=44%300===0X01 2c%数据格式 S+int16的高八位+int16的低八位+int16的低八位(其实是校验和)+0x0D+0x0aclose all;clear all;global data000;global count;global ByteLength;global RecDataInt16;global RecDataNum;global原创 2021-06-25 10:24:21 · 498 阅读 · 0 评论 -
matlab绘图02:横坐标是时间,纵坐标是数据,可以用过后续的温度PID数据显示类似。
close allclear all%设置fig的属性runtimes = 0;recvData = 2;fig1 = figure(1);%设置fig和边框的距离set(fig1, 'Position', [100, 100, 800 700], 'color', 'w'); % xlabel('runtimes');ylabel('data'); grid on;hold on;while ishandle(fig1) %数据更新 plottime=datet原创 2021-06-23 23:57:02 · 2460 阅读 · 0 评论 -
matlab训练1.绘图功能两个数据作图。
自动变化两个数一个横轴,一个纵轴将数据,放在两个数组中,然后将两个一维数组cat结合起来然后绘图如果横轴数据大于fig的横坐标最大数值,那么刷新图,移动到后续的图;close allclear allcount=0;TL=10;%红fig1TR=20;%蓝fig1VS=10;%红fig2VM=20;%蓝fig2%设置fig的属性y_axisMax = 10000;y_axisMin = -10;window_width = 50;window_w = window_wid原创 2021-06-23 16:05:55 · 5811 阅读 · 0 评论