MATLAB是矩阵实验室(MatrixLaboratory)的简称,用于算法开发、数据可视化、数据分析以及数值计算的高级技术计算语言和交互式环境,主要包括MATLAB和Simulink两大部分。MATLAB和Mathematica、Maple并称为三大数学软件。
MATLAB可以进行矩阵运算、绘制函数和数据、实现算法、创建用户界面、连matlab开发工作界面接其他编程语言的程序等,主要应用于工程计算、控制设计、信号处理与通讯、图像处理、信号检测、金融建模设计与分析等领域。
m=3n=3h=3%定义数据的规模
Hx=1Hy=1Hz=1
H=(h-1)*m*n
<a href="https://www.baidu.com/s?wd=CN&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">CN</a>=m*n*h
N=m*n
[x,y,z]=meshgrid(0:Hx:(n-1)*Hx,0:Hy:(m-1)*Hy,0:Hz:(h-1)*Hz)
Cube=reshape(1:N*h,m,n,h)
<a href="https://www.baidu.com/s?wd=MN&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">MN</a>=2*m*n-m-n
X=zeros(<a href="https://www.baidu.com/s?wd=CN&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">CN</a>,1)Y=XZ=X
for i=1:m
for j=1:n
for k=1:h
X(Cube(i,j,k))=x(i,j,k)
Y(Cube(i,j,k))=y(i,j,k)
Z(Cube(i,j,k))=z(i,j,k)
<a href="https://www.baidu.com/s?wd=end&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">end</a>
<a href="https://www.baidu.com/s?wd=end&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">end</a>
<a href="https://www.baidu.com/s?wd=end&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">end</a>
linkN=0
Img=sqrt(-1)
<a href="https://www.baidu.com/s?wd=AA&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">AA</a>=zeros(H+h*<a href="https://www.baidu.com/s?wd=MN&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">MN</a>,1)
for k=1:h-1
for j=1:n
for i=1:m
linkN=linkN+1
<a href="https://www.baidu.com/s?wd=AA&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">AA</a>(linkN)=Cube(i,j,k)+Img*Cube(i,j,k+1)
end
end
end
for k=1:h
for j=1:n-1
for i=1:m
linkN=linkN+1
<a href="https://www.baidu.com/s?wd=AA&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuANbPHFhnjT3m1bvnH7-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRLPjT3rH0knj0zrjT1rjRYn0" target="_blank" class="baidu-highlight">AA</a>(linkN)=Cube(i,j,k)+Img*Cube(i,j+1,k)
end
end
for j=1:n
for i=1:m-1
linkN=linkN+1
AA(linkN)=Cube(i,j,k)+Img*Cube(i+1,j,k)
end
end
end
figure
plot3(X,Y,Z,'r.')
%--plot bond-----
axis equal
P1=real(AA)P2=imag(AA)
line([X(P1)'X(P2)'],[Y(P1)'Y(P2)'],[Z(P1)'Z(P2)'],'color','b')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)