MATLAB里矩阵维度必须一致,怎么改啊,急
N=20nx=1;ny=1;h=1;a=1;m=1deltax=0.05deltay=0.05phia=0.7;phib=0.7Enx=pi^2*h^2*nx^2/(2*...
N=20
nx=1;ny=1;h=1;a=1;m=1
deltax=0.05
deltay=0.05
phia=0.7;phib=0.7
Enx=pi^2*h^2*nx^2/(2*m*a^2)
Eny=pi^2*h^2*ny^2/(2*m*a^2)
px=ones(N-1,1)
Kx=spdiags([px,-2*px,px],[-1,0,1],N-1,N-1)
for i=1:N-1
x(i)=a+deltax*i
Kx(i,i)=-(2-(deltax)^2*Enx)
end
Bx=zeros(N-1,1)
Bx(1)=Bx(1)+phia;Bx(N-1)=Bx(N-1)+phib
py=ones(N-1,1)
Ky=spdiags([py,-2*py,py],[-1,0,1],N-1,N-1)
for j=1:N-1
y(j)=a+deltay*j
Ky(j,j)=-(2-(deltay)^2*Eny)
end
By=zeros(N-1,1)
By(1)=By(1)+phia;By(N-1)=By(N-1)+phib
K=Kx+Ky
B=Bx+By
K1=meshgrid(K)
phi=K1.\B
surf(phi) 展开
nx=1;ny=1;h=1;a=1;m=1
deltax=0.05
deltay=0.05
phia=0.7;phib=0.7
Enx=pi^2*h^2*nx^2/(2*m*a^2)
Eny=pi^2*h^2*ny^2/(2*m*a^2)
px=ones(N-1,1)
Kx=spdiags([px,-2*px,px],[-1,0,1],N-1,N-1)
for i=1:N-1
x(i)=a+deltax*i
Kx(i,i)=-(2-(deltax)^2*Enx)
end
Bx=zeros(N-1,1)
Bx(1)=Bx(1)+phia;Bx(N-1)=Bx(N-1)+phib
py=ones(N-1,1)
Ky=spdiags([py,-2*py,py],[-1,0,1],N-1,N-1)
for j=1:N-1
y(j)=a+deltay*j
Ky(j,j)=-(2-(deltay)^2*Eny)
end
By=zeros(N-1,1)
By(1)=By(1)+phia;By(N-1)=By(N-1)+phib
K=Kx+Ky
B=Bx+By
K1=meshgrid(K)
phi=K1.\B
surf(phi) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询