How can I make this simple image on matlab?

1 次查看(过去 30 天)
I need to be able to recreate this image attached on matlab. Is this possible? Thank you

回答(1 个)

KSSV
KSSV 2020-6-10
编辑:KSSV 2020-6-10
m = 50 ;
A = zeros(m) ;
N = 10 ;
for i = N:N:m
n = m-i ;
t = ones(1,n) ;
A = A+diag(t,-i) ;
end
for i = N:N:m
n = m-i ;
t = ones(1,n) ;
A = A+diag(t,i) ;
end
A = A+diag(ones(1,m)) ;
A = A+fliplr(A) ;
pcolor(A)
shading interp
  1 个评论
Love Matlab
Love Matlab 2020-6-10
Thank you! Is it possible to make all the diagonal lines solid? This is the image I get with your code

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by