用matlab画B样条曲面报错~
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/08/24 03:52:57
用matlab画B样条曲面报错~
function l= BSplineMian(p00,p01,p02,p03,p10,p11,p12,p13,p20,p21,p22,p23,p30,p31,p32,p33)
syms u;
syms v;
a = [u^3 u^2 u 1];
m = 1/6*[1 3 -3 1;3 -6 3 0;-3 0 3 0;1 4 1 0];
p = [p00 p01 p02 p03;p10 p11 p12 p13;p20 p21 p22 p23;p30 p31 p32 p33];
b = [v^3 v^2 v 1];
l = a*m*p*m'*b';
然后调用的时候
u = [1:0.01:1];
>> t = [1:0.01:1];
>>
>>
>> p00 = [1 1 1];
>> p01 = [1 2 2];
>> p02 = [1 3 3];
>> p03 = [1 4 4];
>> p10 = [2 0.8 1.5];
>> p11 = [2 2.3 2.4];
>> p12 = [2 3.3 3.8];
>> p13 = [2 4.3 4.9];
>> p20 = [3 0.5 1];
>> p21 = [3 2 2.5];
>> p22 = [3 3.8 3];
>> p23 = [3 4.2 4.2];
>> p30 = [4 1 0.5];
>> p31 = [4 2.5 2.2];
>> p32 = [4 3.5 3.5];
>> p33 = [4 4 6];
>>
l = BSplineMian(p00,p01,p02,p03,p10,p11,p12,p13,p20,p21,p22,p23,p30,p31,p32,p33)
Error using ==> sym.mtimes
Inner matrix dimensions must agree.
Error in ==> BSplineMian at 8
l = a*m*p*m'*b'
那我把p00到p33都声明为syms然后调用函数的时候再传进去~为什么还是不对呢~
能给出一个正确的解决方案吗?
function l= BSplineMian(p00,p01,p02,p03,p10,p11,p12,p13,p20,p21,p22,p23,p30,p31,p32,p33)
syms u;
syms v;
a = [u^3 u^2 u 1];
m = 1/6*[1 3 -3 1;3 -6 3 0;-3 0 3 0;1 4 1 0];
p = [p00 p01 p02 p03;p10 p11 p12 p13;p20 p21 p22 p23;p30 p31 p32 p33];
b = [v^3 v^2 v 1];
l = a*m*p*m'*b';
然后调用的时候
u = [1:0.01:1];
>> t = [1:0.01:1];
>>
>>
>> p00 = [1 1 1];
>> p01 = [1 2 2];
>> p02 = [1 3 3];
>> p03 = [1 4 4];
>> p10 = [2 0.8 1.5];
>> p11 = [2 2.3 2.4];
>> p12 = [2 3.3 3.8];
>> p13 = [2 4.3 4.9];
>> p20 = [3 0.5 1];
>> p21 = [3 2 2.5];
>> p22 = [3 3.8 3];
>> p23 = [3 4.2 4.2];
>> p30 = [4 1 0.5];
>> p31 = [4 2.5 2.2];
>> p32 = [4 3.5 3.5];
>> p33 = [4 4 6];
>>
l = BSplineMian(p00,p01,p02,p03,p10,p11,p12,p13,p20,p21,p22,p23,p30,p31,p32,p33)
Error using ==> sym.mtimes
Inner matrix dimensions must agree.
Error in ==> BSplineMian at 8
l = a*m*p*m'*b'
那我把p00到p33都声明为syms然后调用函数的时候再传进去~为什么还是不对呢~
能给出一个正确的解决方案吗?
a*m*p
返回的是1×12的矩阵,后边的m'是4×4的,所以不能相乘.
返回的是1×12的矩阵,后边的m'是4×4的,所以不能相乘.