it does not understand pcolor, even when I load PyPlot. Why? Do we need to
load a different package?


2014-11-25 15:59 GMT-05:00 Steven G. Johnson <stevenj....@gmail.com>:

> Note that you don't need to use meshgrid, repmat, or similar, because you
> can use broadcasting operations (e.g .+) to combine row and column vectors:
>
> col = 20;
> m = 400;
> cx = -.6;
> cy = 0;
> l = 1.5;
> x = linspace(cx-l,cx + l,m);
> y = linspace(cy-l,cy + l,m);
> Z = zeros(m,m);
> C = x' .+ im * y;
>
> for k = 1:col;
>     Z = Z.^2+C;
> end
> W = exp(-abs(Z));
>
> pcolor(W, cmap="copper");
> colorbar()
> axis("equal")
>
>
> (Note also that there are more efficient ways to do this in Julia because
> you aren't forced to rely on vectorized operations, which allocate lots of
> temporary arrays, in order to get good performance.)
>

Reply via email to