function N1d = shapeFn1d(gp1d)
n1 = 0.5*(1-gp1d(1,1));
n2 = 0.5*(1+gp1d(2,1));
N1d = [n1, n2];
end
gp1d是一个2x1数组,我期望N1d是一个1x2数组,但它出来作为2x2数组,我不知道为什么。谁能帮帮我?
这是我的gp1d
[-0.57735;
0.57735];
这是程序显示的N1d
[0.78868, 0.21132;
0.21132, 0.78868];
这是我所期望的N1d[ 0.78868, 0.78868 ];
你确定没有打错字吗?我复制并粘贴了你的代码,似乎很好,无论是在Octave和Matlab:
>> system('cat shapeFn1d.m')
function N1d = shapeFn1d(gp1d)
n1 = 0.5*(1-gp1d(1,1));
n2 = 0.5*(1+gp1d(2,1));
N1d = [n1, n2];
end
ans = 0
>> gp1d=[-0.57735; 0.57735];
>> shapeFn1d(gp1d)
ans =
0.78868 0.78868
>>