how i do a 3D plot of rect(n1,n2) function
8 次查看(过去 30 天)
显示 更早的评论
how i do a 3D plot of rect(n1,n2) function
1 个评论
Star Strider
2021-3-15
Please provide the documentatiion link to that function. (It is not present in the online documentation, and I cannot find it in an Interweb search.)
回答(1 个)
KALYAN ACHARJYA
2021-3-14
编辑:KALYAN ACHARJYA
2021-3-14
n1=-1;
n2=1;
[x,y]=meshgrid(n1:0.01:n2,n1:0.01:n2);
z=zeros(size(x,1),size(x,2));
z(x>-0.5 & x<0.5)=1;
s=surf(x,y,z,'FaceAlpha',0.5);
s.EdgeColor = 'b';
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/549803/image.png)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!