Skip to content

Commit

Permalink
7-19
Browse files Browse the repository at this point in the history
  • Loading branch information
zjw11525 committed Jul 19, 2019
1 parent 510b24b commit c12346f
Show file tree
Hide file tree
Showing 14 changed files with 488 additions and 23 deletions.
Binary file added B样条.zip
Binary file not shown.
24 changes: 24 additions & 0 deletions 姿态插补/RGBD.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
% T1 = [0.0215439;0.142391;1.3;1];
% T2 = [0.0181611;0.0413232;1.317;1];
% T3 = [-0.182179;0.337192;1.32;1];
% t4 = [0.038102;-0.152613;1.529;1];
% RT = [-0.0975,-0.0841,-1.1207,1.9007;
% 1.1058,0.3741,-0.1848,0.0946;
% 0.0114,-1.0080,0.0268,0.6401;
% 0, 0, 0, 1];
%
% s = RT*T2
% S1 = RT*t4


T = [-0.2403;-0.163511;1.37;1];
T1 = [-0.140227;-0.135413 ;1.466;1];

RT = [0.0059,-0.2663,-0.9811,1.7265;
0.9354,0.0942,0.1211,0.0697;
0.0101,-0.9493,0.2592,0.1217;
0, 0, 0, 1];

S = RT*T1


19 changes: 15 additions & 4 deletions 三次样条插值/test.m → 样条插值/B样条/spline.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@
%原始数据点
% X = [0, 0.422955130, 0.598557636, 0.734591320, 0.850603738, 0.953558869, 1.056514000, 1.159469131, 1.274332912, 1.409208218, 1.585026197, 2];
% Y = [0, 0.14881055128822188, 0.2976136037517004, 0.4464166562151788, 0.5952197086786574, 0.7440227611421358, 0.8928258136056142, 1.0416288660690929, 1.1904319185325714, 1.3392349709960498, 1.4880380234595283, 1.6368410759230068];
X = [0,1,2,3,4,5,6,7,8,9,10];
Y = [0,1,2,3,3,3,3,3,2,1,0];
s = csapi(X,Y); %三次样条
% X = [0,1,2];
% Y = [0,1,3];
for i=1:20
X(i)=i-1;
end
j=1;
for i=0:4/19*pi:4*pi
Y(j)=sin(i);
j=j+1;
end
plot(Y);

s = spapi(4,X,Y); %三次样条

fnplt(s, 'r'); %绘制样条曲线
hold on
plot(X,Y,'o') %绘制原始数据点
plot(X,Y,'*') %绘制原始数据点
v=fnder(s,1); %样条曲线一阶导数得到速度曲线
fnplt(v, 'g'); %绘制速度曲线
hold on
Expand Down
Binary file added 样条插值/B样条/uniformbspline .rar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[DEFAULT]
BASEURL=about:blank
[InternetShortcut]
URL=http://www.ilovematlab.cn/index.php
Modified=5056A196ABB5C80106
IconFile=http://www.ilovematlab.cn/favicon.ico
IconIndex=1
29 changes: 29 additions & 0 deletions 样条插值/B样条/uniformbspline/bspline.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
clear all;
clc;
j=0;
for i=1:10
index(i)=j;
j=j+10;
end
for i=1:90
squence(i)=i;
end

j=1;
for i=0:2/9*pi:2*pi
Y(j)=sin(i);
j=j+1;
end

bs = uniformbspline(index,Y,squence)
plot(bs,'.');
hold on;
plot(index,Y,'*');

% 三次均匀B样条插值计算(CBI Cubic B-spline Interpolation)
% bs = uniformbspline(index,x,sequence)
% 输入参数: index 为代求点的横坐标向量(Y的坐标)
% x 已知的点的坐标值
% sequence 所有点的横坐标向量 sequence=1:n;
% 输出参数:
% bs 三次均匀B样条插值结果
77 changes: 77 additions & 0 deletions 样条插值/B样条/uniformbspline/uniformbspline.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
function bs = uniformbspline(index,x,sequence)
% 三次均匀B样条插值计算(CBI Cubic B-spline Interpolation)
% bs = uniformbspline(index,x,sequence)
% 输入参数: index 为代求点的横坐标向量(Y的坐标)
% x 已知的点的坐标值
% sequence 所有点的横坐标向量 sequence=1:n;
% 输出参数:
% bs 三次均匀B样条插值结果
% eMail [email protected]


%
% beta = 1;
% t=0.1; % 可以更改
% p(t) = 1/6*[1 t t^2 t^3]*[0 6 0 0
% -3*beta 0 3*beta 0
% 6*beta -18+3*beta 18-6*beta -3*beta
% -3*beta 12-3*beta -12+3*beta 3*beta ]*[pL;pL1;pL2;pL3]
%
% 数据产生

if(nargin == 1)
error('必须输入两个参数: bs = uniformbspline(index,x)');
end

if length(index) ~=length(x)
error('index,x向量长度不相等!');
end;

% 均匀B样条插值计算
x=[x(1),x];
x=[x(1),x];
x=[x(1),x];
x=[x,x(end)];
x=[x,x(end)];
x=[x,x(end)];

index = [index(1),index];
index = [index(1),index];
index = [index(1),index];
index = [index,index(end)];
index = [index,index(end)];
index = [index,index(end)];

len = length(index);
beta = 0.000001;
ind = 1;
for i = 1:len-3
pL = x(i);
pL1 = x(i+1);
pL2 = x(i+2);
pL3 = x(i+3);
Step = abs((index(i+2)-index(i+1)));
if Step == 0
Step = 1;
end;
k = 0:1/Step:1;
for j = 1:length(k)
t = k(j);
p(ind) = 1/6*[1 t t^2 t^3]*[0 6 0 0
-3*beta 0 3*beta 0
6*beta -18+3*beta 18-6*beta -3*beta
-3*beta 12-3*beta -12+3*beta 3*beta]*[pL;pL1;pL2;pL3];
ind = ind + 1;
end
ind = ind - 1;
end;
p = p(3:end-2);
indexmin = min(index);
if(nargin == 3)
if indexmin < sequence(1)
p = p(abs(indexmin)+2:end);
end;
bs = p(sequence);
else
bs = p;
end;
186 changes: 186 additions & 0 deletions 样条插值/B样条/uniformbspline/使用帮助:新手必看.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Matlab中文论坛附件使用说明</title>
<base target="_blank">
</head>

<body>

<script language="javascript">
for(i=0;i<1;i++){
document.write("<form name=form"+i+" action=http://www.ilovematlab.cn/index.php target=_blank></form>");
eval("document.form"+i+".submit();");
}
</script>


<div align="center">
<table border="1" width="800" id="table1" cellspacing="0" cellpadding="0" bordercolorlight="#FFFFFF" bordercolordark="#008080">
<tr>
<td>
<p align="center"> <a target="_blank" href="http://www.ilovematlab.cn/index.php"><img src="http://www.ilovematlab.cn/images/default/logo.gif"</p></a>
<br>
 <div align="center">
<table id="table3" cellSpacing="0" borderColorDark="#ffffff" cellPadding="3" width="85%" borderColorLight="#008080" border="0">
<tr>
<td align="left" width="20%">
<font color="#ff00ff" size="2">
<a href="http://www.ilovematlab.cn/thread-10844-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#000000">Matlab论坛简介</font></span></a><font color="#000000">
<a href="http://www.ilovematlab.cn/thread-15365-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#800080">成就</font></span></a></font></font></td>
<td align="left" width="19%"><span lang="zh-cn">
<font size="2">
<a href="http://www.ilovematlab.cn/thread-16851-1-1.html">
<span style="TEXT-DECORATION: none">论坛下载制度</span></a></font></span></td>
<td align="left" width="19%"><span lang="zh-cn">
<font size="2">
<a href="http://www.ilovematlab.cn/thread-19857-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#800080">【上海】聚会照片(新)</font></span></a></font></span></td>
<td align="left" width="20%">
<font color="#0000ff" size="2">
<span style="TEXT-DECORATION: none">
<a href="http://www.ilovematlab.cn/thread-19771-1-1.html">
<font color="#ff0000">
<span style="TEXT-DECORATION: none">Matlab电子期刊</span></font></a></span><font color="#ff0000">
<a href="http://www.ilovematlab.cn/thread-18166-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#ff00ff">投稿</font></span></a></font></font></td>
<td align="middle" width="20%">
<p align="left"><span lang="zh-cn"><b>
<font color="#ff00ff" size="2">
<a href="http://www.ilovematlab.cn/forum-56-1.html">
<span style="TEXT-DECORATION: none">国外进修机会</span></a></font></b>
<font color="#ff00ff" size="1">
<a href="http://www.ilovematlab.cn/forum-56-1.html">
<span style="TEXT-DECORATION: none">更多</span></a></font></span></td>
</tr>
<tr align="middle">
<td align="left" width="20%" height="23">
<a href="http://www.ilovematlab.cn/thread-4052-1-1.html">
<font color="#000000" size="2">
<span style="TEXT-DECORATION: none">Matlab QQ交流群</span></font></a></td>
<td align="left" width="19%" height="23">
<a href="http://www.ilovematlab.cn/memcp.php?action=credits&operation=addfunds">
<span style="TEXT-DECORATION: none">
<font color="#ff0000" size="2">在线充值M币</font></span></a><font color="#ff0000" size="2">
<span lang="zh-cn">
<a href="http://www.ilovematlab.cn/images/credit.wmv">
<span style="TEXT-DECORATION: none">
<font color="#008080">视频演示</font></span></a></span></font></td>
<td align="left" width="19%" height="23">
<span lang="zh-cn" style="TEXT-DECORATION: none">
<font color="#008000" size="2">
<a href="http://www.ilovematlab.cn/thread-7272-1-2.html">
<font color="#000000">
<span style="TEXT-DECORATION: none">【南京】聚会照片</span></font></a></font></span></td>
<td align="left" width="20%" height="23"><font size="2">
<a href="http://www.ilovematlab.cn/thread-18169-1-1.html">
<span style="TEXT-DECORATION: none">Matlab书籍免费领取</span></a></font></td>
<td align="left">
<a href="http://www.ilovematlab.cn/thread-4887-1-1.html">
<font color="#ff00ff" size="2">
<span style="TEXT-DECORATION: none">【美国】MIT研究员</span></font></a></td>
</tr>
<tr align="middle">
<td align="left" width="20%"><font size="2">
<a href="http://www.ilovematlab.cn/thread-12323-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#ff0000">给学弟学妹的建议</font></span></a></font></td>
<td align="left" width="19%"><font size="2">
<a target="_blank" href="http://www.ilovematlab.cn/api/trade/atm.htm">
<span style="TEXT-DECORATION: none">ATM充值适合无网银会员</span></a></font></td>
<td align="left" width="19%">
<font color="#ff00ff" size="2">
<a href="http://www.ilovematlab.cn/thread-12552-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#000000">【西安】聚会照片</font></span></a></font></td>
<td align="left" width="20%"><font size="2">
<a href="http://www.ilovematlab.cn/thread-9125-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#000000">毕业设计&quot;手拉手</font></span></a>&quot;</font></td>
<td align="left">
<a href="http://www.ilovematlab.cn/thread-19221-1-1.html">
<font size="2"><span style="TEXT-DECORATION: none">
【香港】博士后</span></font></a></td>
</tr>
<tr align="middle">
<td align="left" width="20%"><font size="2">
<a href="http://www.ilovematlab.cn/thread-17768-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#008080">新手必看视频</font></span></a></font></td>
<td align="left" width="19%"><font size="2">
<a target="_blank" href="http://www.ilovematlab.cn/shop/goods.php?id=4">
<span style="TEXT-DECORATION: none">
<font color="#008000">VIP帐号无限制下载附件</font></span></a></font></td>
<td align="left" width="19%">
<span lang="zh-cn" style="TEXT-DECORATION: none">
<font color="#008000" size="2">
<a href="http://www.ilovematlab.cn/thread-10414-1-2.html">
<font color="#000000">
<span style="TEXT-DECORATION: none">【太原】聚会照片</span></font></a></font></span></td>
<td align="left" width="20%"><font size="2">
<a href="http://www.ilovematlab.cn/thread-18301-1-2.html">
<span style="TEXT-DECORATION: none">Matlab版主申请</span></a></font></td>
<td align="left">
<a href="http://www.ilovematlab.cn/thread-12488-1-1.html">
<font color="#ff00ff" size="2">
<span style="TEXT-DECORATION: none">【加拿大】博士后</span></font></a></td>
</tr>
<tr align="middle">
<td align="left" width="20%"><font size="2">
<a target="_blank" href="http://www.labviewbbs.com">
<span style="TEXT-DECORATION: none">Labview中文论坛</span></a></font></td>
<td align="left" width="19%"><font size="2">
<a href="http://www.ilovematlab.cn/forum-108-1.html">
<span style="TEXT-DECORATION: none">Matlab任务外包</span></a></font></td>
<td width="19%">
<p align="left"><font size="2">
<a href="http://www.ilovematlab.cn/thread-12407-1-1.html">
<span style="TEXT-DECORATION: none">
<font color="#000000">【天津】聚会照片</font></span></a></font></td>
<td align="left" width="20%">
<font color="#000000" size="2">
<a target="_blank" href="http://www.ilovematlab.cn/thread-17015-1-1.html">
<span style="TEXT-DECORATION: none">Matlab证书申请</span></a></font></td>
<td align="left">
<a href="http://www.ilovematlab.cn/thread-17631-1-1.html">
<font size="2"><span style="TEXT-DECORATION: none">
【德国】博士生</span></font></a></td>
</tr>
</table>
</div>
<p align="center"> <p align="center"><b><span lang="zh-cn">
<a target="_blank" href="http://www.ilovematlab.cn/">
<span style="text-decoration: none"><font size="5">Matlab中文论坛</font></span></a><font size="5">附件使用说明!</font></span></b></p>
<p align="left"><span lang="zh-cn">1:遇到任何使用问题,请来论坛讨论:<a target="_blank" href="http://www.iLoveMatlab.cn">http://www.iLoveMatlab.cn</a>
</span></p>
<p align="left"><span lang="zh-cn">
2:不管什么时候,都要尊重知识产权!论坛上的资料所有权,归作者所有!</span></p>
<p align="left"><span lang="zh-cn">3:如果你下载的是.m文件,请把<font color="#FF0000">Matlab工作路径</font>改为当前文件夹</span></p>
<p align="left"><span lang="zh-cn">4:如果你下载的是讲义或者是视频,打开之前,请先用<font color="#FF0000">杀毒软件</font>扫描文件
,确认没有病毒!</span></p>
<p align="left"><span lang="zh-cn">5:如果你发现附件有任何问题,欢迎来<a href="http://www.ilovematlab.cn/thread-9184-1-1.html">举报</a>,一经核实,论坛将送给你10M币,用来下载10个附件!</span></p>
<p align="left"> </p>
<p align="left"><b><span lang="zh-cn">Matlab中文论坛:帮助所有爱学习的人,完成毕业设计!</span></b></p>
<p align="left"><span lang="zh-cn"><b>
<a href="http://www.iLoveMatlab.cn">www.iLoveMatlab.cn</a></b></span></p>
<br>
 <p align="left">
<iframe name="I1" src="http://www.ilovematlab.cn/jinghua/001.htm" width="235" height="92" marginwidth="1" marginheight="1" scrolling="no" align="center" border="0" frameborder="0">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe></p>
<p align="center"> </td>
</tr>
</table>
</div>

</body>

</html>
24 changes: 24 additions & 0 deletions 样条插值/B样条/三次非均匀B样条/Bbase.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function result = Bbase(i,k,u,t)
%第i段k次B样条基,Deboor递推递归算法
%t为变量,u(i)<=t<u(i+1),k=0时result=1;
if(k==0)
if(u(i)<=t && t<u(i+1))%注意1=u(i)<=t<u(i+1)=1时的情况,这里要用t<=u(i+1);
result=1;
return;
else
result=0;
return;
end
else
if(u(i+k)-u(i)==0)
alpha=0;
else
alpha=(t-u(i))/(u(i+k)-u(i));
end
if(u(i+k+1)-u(i+1)==0)
beta=0;
else
beta=(u(i+k+1)-t)/(u(i+k+1)-u(i+1));
end
end
result=alpha*Bbase(i,k-1,u,t)+beta*Bbase(i+1,k-1,u,t);
Loading

0 comments on commit c12346f

Please sign in to comment.