-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.m
52 lines (45 loc) · 1.04 KB
/
run.m
1
% 主程序clc;clear;close all;% 读取txt文件[to_str,m] = read_txt;% 将数据集数据存到数组里面,并且打印segment = zeros(m,17);segment = get_data(segment,m,to_str);% 画出运动轨迹plot_tra(segment,m);A = 0.193702948918262;segment(1,12)=A;np=1;% 画出(m-1)条线段中点的变化for i=1:(m-1) %计算角度 if i<( length( segment(:,17) )-1 ) segment= cal_angle( segment,i); else segment(i,15)=1; end % 配置速度参数 [ segment, distance, t] = velocity_parameter( segment, i); % 制作单次运动轨迹 h=single_tra( i, segment, distance, t); mydata = save_csv(segment); % 记录动画帧 axis equal; axis([0 45 0 70]); n = length(t); nq=np+n-1; F(np:nq) = struct('cdata',[],'colormap',[]); % 制作动画帧 for j = 1:n set( h, 'xdata', segment(i,1)+distance(1,j), 'ydata', segment(i,2)+distance(2,j) ); F(np+j-1) = getframe; end np=nq+1; delete(h);end% 播放动画帧fprintf('\n\n动态效果演示开始\n\n');movie(F,1,60);fprintf('\n\n动态效果演示结束\n\n');