To plot, you must use a range of values. So using x = a + b*i :
[a,b] = meshgrid(-10:0.1:10); %// creates two grids ComplexValue = a+1i*b; %// get a single, complex valued grid CompFun = @(x)(- real(x.^3) + imag((10 + x.*1i)./(- 100.*x.^2 + x.*5i + 20))); %// add dots for element wise calculation result = CompFun(ComplexValue); %// get results pcolor(a,b,result) %// plot shading interp %// remove grid borders by interpolation colorbar %// add colour scale ylabel 'Imaginary unit' xlabel 'Real unit'

I needed to add points (e.g. element multiplication) to your equation to make it work.
Also, contourf as suggested in the comment from @AndrasDeak :
figure contourf(a,b,result,51) %// plots with 51 contour levels colorbar
I used meshgrid -10:0.01:10 here for a larger resolution:

If you do not want to manually copy the solution to add multiplicative points to cartoons, you can resort to loops:
grid = -10:0.1:10; result(numel(grid),numel(grid))=0; %// initialise output grid for a = 1:numel(grid) for b = 1:numel(grid) x = grid(a)+1i*grid(b); result(a,b) = ImaginaryPart(x); end end
This gives the same result, but with pluses and minuses. This is slower than matrix multiplication, i.e. Adding points to your equation, but it does not require manual manipulation of the conclusions.
source share