提问人:Faito Dayo 提问时间:11/14/2022 最后编辑:beakerFaito Dayo 更新时间:11/14/2022 访问量:37
MATLAB 说我的等号两边的矩阵大小不相等
MATLAB says my matrices on both side of equal sign are not equal in size
问:
这是我的代码
syms xi eta
N1 = ((1+xi)*(1+eta))/4;
N2 = ((1-xi)*(1+eta))/4;
N3 = ((1-xi)*(1-eta))/4;
N4 = ((1+xi)*(1-eta))/4;
Nxieta = [N1 N2 N3 N4];
difNxieta = sym(zeros(2,4))
for i = 1:4
difNxieta(1,i) = diff(Nxieta(1:i),xi);
difNxieta(2,i) = diff(Nxieta(1:i),eta);
end
这是它向我展示的错误
Unable to perform assignment because the size of the left side is 1-by-1 and the
size of the right side is 1-by-2.
Error in sym/privsubsasgn (line 1128)
L_tilde2 =
builtin('subsasgn',L_tilde,struct('type','()','subs',{varargin}),R_tilde);
Error in sym/subsasgn (line 965)
C = privsubsasgn(L,R,inds{:});
Error in Ae420_FEA_project>localstiffnessmatrix (line 55)
difNxieta(1,i) = diff(Nxieta(1:i),xi);
但我不明白。diff(Nxieta(i:1),习) 不是数组。
答: 暂无答案
评论
diff(Nxieta(1:i),xi)
[eta/4 + 1/4, - eta/4 - 1/4]
dbstop if error
是你的朋友