pcolor returns error second time around

2 ビュー (過去 30 日間)
Ejike
Ejike 2012 年 10 月 6 日
I ran this code for julia sets with x=-2:0005:2, y=-2:0.005:2 and it worked perfectly. I now changed the values of x and y. and it gives the error message below.
c=-0.835 - 1i*0.232;
x=-0.2:0.005:0.2;
y=-0.2:0.005:0.2;
[X,Y]=meshgrid(x,y);
z=(X + Y*1i);
n_max=256;
b=10000; %blowup parameter. stop an iteration when |z|==b.
n_matrix=zeros(800,800);
for n = 1:n_max
f_z = z.^2 + c;
z = f_z ;
if abs(z)>10000
n_matrix(n)=n;
if (z.^2+c)^n_max<10000
n_matrix(n)=n;
end
end
end
colormap prism(256)
pcolor(n);
shading flat;
axis('square','equal','off')
Error using pcolor (line 54)
Color data input must be a matrix.
Error in julia (line 24) pcolor(n);

採用された回答

Image Analyst
Image Analyst 2012 年 10 月 6 日
Use imagesc(n_matrix) instead of pcolor(n). You have some other problems though.
  2 件のコメント
Ejike
Ejike 2012 年 10 月 7 日
please what are the other problems
Image Analyst
Image Analyst 2012 年 10 月 7 日
Well, did it run perfectly and do what you want after you replaced pcolor with imagesc?

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 10 月 7 日
colormap prism(256)
should be
colormap(prism(256))

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by