MATLAB浮点型运算生成6变形

%**************分段全部辨识出轨迹*************%
% %**************仿真出误差值*******************%
%  format long   %小数点位数
clear
clc
format long 
syms K_YX1 K_YX2 K_YX3;
syms K_ZX1 K_ZX2 K_ZX3;
 syms x y   %*********以后是变量************%
 syms  K_XX1;
 deta_xx=K_XX1*x;
 syms KXY1 KXY2 KXY3;
 deta_xy=KXY1*y+KXY2*y*y+KXY3*y*y*y;
 syms azy1 azy2 azy3
 
 syms KYY1;
syms KYX1 KYX2 KYX3 
eta_zy=azy1*y+azy2*y*y+azy3*y*y*y
 syms phi_xy
  syms azx1 azx2 azx3
  eta_zx=azx1*x+azx2*x*x+azx3*x*x*x
  
  Sexangle_data=importdata('Sexangle.txt');     % 将生成的MKMATLAB.txt文件导入工作空间,变量
% load Sexangle.txt;
%判断第i个最接近第一点
FirstError=Sexangle_data(1:484,:);
Numberline1=484
fid = fopen('data0.txt','wt');
[m,n]=size(FirstError)
for i=1:1:m
    for j=1:1:n
        if(j==n)
            fprintf(fid,'%g\n',FirstError(i,j));
        else
            fprintf(fid,'%g  ',FirstError(i,j));   
        end
    end
end
fclose(fid);
X2=10;
X3=20;
X4=-10;
X5=-20;
%******判断在10之间**
for i=484:1:4002
    if(X_R(i)<X2)
        break
    end
  end
line1=i;
NumberLine2=line1-Numberline1+1;
%*********生成第一段直线************%
x1=10:(10)/NumberLine2:20;
x1=Fanzhuan(x1);
y1=1.732058*(x1-20);
t=x1;
k1=1.732058;
tLiney=k1*(t-20);
deta_xx=subs(deta_xx,{K_XX1,x},{-0.000140,t});
%****************默认在一起了*******************%
deta_xy=subs(deta_xy,{KXY1,KXY2,KXY3,y},{0.002088,-0.0000833,0.0000015,tLiney});
eta_zy=subs(eta_zy,{azy1,azy2,azy3,y},{-0.0000166,0.0000002,0,tLiney});
eta_zx=subs(eta_zx,{azx1,azx2,azx3,x},{-0.000000394,0.000000012,0,t});
len=length(t);
%************Error_deta_y*********%
deta_yy=KYY1*y;
deta_yx=KYX1*x+KYX2*x*x+KYX3*x*x*x;
%*****赋值系数


deta_yx=subs(deta_yx,{KYX1,KYX2,KYX3,x},{0.000001151,-0.0000002,0.000000006,t});
deta_yy=subs(deta_yy,{KYY1,y},{0.000008675,t});
Error_deta_x=deta_xx+deta_xy+y1.*eta_zx
Error_deta_y=deta_yy+deta_yx-x1.*eta_zy


Error_x_1=x1+Error_deta_x;
Error_y_1=y1+Error_deta_y;
Error_x_1=Error_x_1'
Error_y_1=Error_y_1'


data1=[Error_x_1,Error_y_1]


line2=964
or i=484:1:4002
    if(X_R(i)<X2)
        break
    end
  end
line1=i;
NumberLine2=line1-Numberline1+1;


%*********生成第一段直线************%
x1=10:(10)/NumberLine2:20;
x1=Fanzhuan(x1);
y1=1.732058*(x1-20);


%********分解为下标点
%************选取点****************%


t=x1;
k1=1.732058;
tLiney=k1*(t-20);
deta_xx=subs(deta_xx,{K_XX1,x},{-0.000140,t});
%****************默认在一起了*******************%
deta_xy=subs(deta_xy,{KXY1,KXY2,KXY3,y},{0.002088,-0.0000833,0.0000015,tLiney});
eta_zy=subs(eta_zy,{azy1,azy2,azy3,y},{-0.0000166,0.0000002,0,tLiney});
eta_zx=subs(eta_zx,{azx1,azx2,azx3,x},{-0.000000394,0.000000012,0,t});
len=length(t);
%************Error_deta_y*********%
deta_yy=KYY1*y;
deta_yx=KYX1*x+KYX2*x*x+KYX3*x*x*x;
%*****赋值系数


deta_yx=subs(deta_yx,{KYX1,KYX2,KYX3,x},{0.000001151,-0.0000002,0.000000006,t});
deta_yy=subs(deta_yy,{KYY1,y},{0.000008675,t});
Error_deta_x=deta_xx+deta_xy+y1.*eta_zx
Error_deta_y=deta_yy+deta_yx-x1.*eta_zy


Error_x_1=x1+Error_deta_x;
Error_y_1=y1+Error_deta_y;
Error_x_1=Error_x_1'
Error_y_1=Error_y_1'


data1=[Error_x_1,Error_y_1]




%*************包括两条直线********************8%
fid = fopen('data1.txt','wt');
[m,n]=size(data1)
for i=1:1:m
    for j=1:1:n
        if(j==n)
            fprintf(fid,'%.6f\n',data1(i,j));
        else
            fprintf(fid,'%.6f  ',data1(i,j));   
        end
    end
end
fclose(fid);


%*************包括两条直线*********补偿之后的轨迹***********8%
fid = fopen('Line0andLine1.txt','wt');
Firstep=Sexangle_data(1:484,:);
[m,n]=size(Firstep)  %***********采集的点的误差
for i=1:1:m
    for j=1:1:n
        if(j==n)
            fprintf(fid,'%.6f\n',Firstep(i,j));
        else
            fprintf(fid,'%.6f  ',Firstep(i,j));   
        end
    end
end
Idea1data=[x1',y1'];


[m,n]=size(Idea1data)
%ImataeSout 随机矩阵
for i=1:1:m
    for j=1:1:n
          ImataeSout(i,j)=99*rand()/1000000;
    end
end
NatureData=Idea1data-ImataeSout
NatureData=[NatureData Firstep(1:m,3)]
n=n+1;
for i=1:1:m
    for j=1:1:n
        if(j==n)
            fprintf(fid,'%.6f\n',NatureData(i,j));
        else
            fprintf(fid,'%.6f  ',NatureData(i,j));   
        end
    end
end
fclose(fid);
ne2=964
%***************第三段就是964个开始.....%*******
%*********X10-->X-10***************%
X_R= Sexangle_data(:,1);
Y_R= Sexangle_data(:,2);
X2=10;
X3=20;
X4=-10;
X5=-20;
%******判断在10之间**
for i=line2:1:4002
    if(X_R(i)<X4)
        break
    end
  end
line3=i-1;
NumberLine2=line3-Numberline1+1;


%*********生成第一段直线*,-10到10***********%
x3=-10:(10)/NumberLine2:X2;
x3=Fanzhuan(x3);
len=length(x3);
y3=-17.32058*ones(1,len);  %*********y一直不变


%********分解为下标点
%************选取点****************%
syms KYY1;
syms KYX1 KYX2 KYX3 
eta_zy=azy1*y+azy2*y*y+azy3*y*y*y
syms phi_xy
syms azx1 azx2 azx3
eta_zx=azx1*x+azx2*x*x+azx3*x*x*x
t=x3;
tLiney=y3;
deta_xx=subs(deta_xx,{K_XX1,x},{-0.000140,t});
%****************默认在一起了*******************%
deta_xy=subs(deta_xy,{KXY1,KXY2,KXY3,y},{0.002088,-0.0000833,0.0000015,tLiney});
eta_zy=subs(eta_zy,{azy1,azy2,azy3,y},{-0.0000166,0.0000002,0,tLiney});
eta_zx=subs(eta_zx,{azx1,azx2,azx3,x},{-0.000000394,0.000000012,0,t});
len=length(t);
%************Error_deta_y*********%
deta_yy=KYY1*y;
deta_yx=KYX1*x+KYX2*x*x+KYX3*x*x*x;
%*****赋值系数


deta_yx=subs(deta_yx,{KYX1,KYX2,KYX3,x},{0.000001151,-0.0000002,0.000000006,t});
deta_yy=subs(deta_yy,{KYY1,y},{0.000008675,t});
Error_deta_x=deta_xx+deta_xy+y3.*eta_zx
Error_deta_y=deta_yy+deta_yx-x3.*eta_zy


Error_x_3=x3+Error_deta_x;
Error_y_3=y3+Error_deta_y;
Error_x_3=Error_x_3'
Error_y_3=Error_y_3'


data2=[Error_x_3,Error_y_3]
fid = fopen('data2.txt','wt');
[m,n]=size(data2)
for i=1:1:m
    for j=1:1:n
        if(j==n)
            fprintf(fid,'%.6f\n',data2(i,j));
        else
            fprintf(fid,'%.6f  ',data2(i,j));   
        end
    end
end
fclose(fid);
Ideadata=[x3' y3' ];


 
fid = fopen('data3Ideal.txt','wt');
%********前面484个点************%




[m,n]=size(Ideadata)
for i=1:1:m
    for j=1:1:n
          ImataeSout(i,j)=99*rand()/1000000;
    end
end
NatureData=Ideadata-ImataeSout
for i=1:1:m
    for j=1:1:n
        if(j==n)
            fprintf(fid,'%.6f\n',NatureData(i,j));
        else
            fprintf(fid,'%.6f  ',NatureData(i,j));   
        end
    end
end
fclose(fid);
%***********第四段***********%
%*********生成第一段直线*,-10到-20***********%
x3=-20:(10)/NumberLine2:-10;
x3=Fanzhuan(x3);
len=length(x3);
y3=-17.32058*ones(1,len);  %*********y一直不变

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值