% % code01c.m -- djm -- 07 sept 2006 % % 1D complex function plotter, real & imag % % be sure both code01a.m & code01c.m are in the same folder code01a % define 1D grid data N = 100; L = 5; ang = 2*pi/3; r = -L:2*L/100:L; z = r*exp(i*ang); % evaluate function along complex ray poly = z.^3 - 2*z.^2 - 2*z - 3; % plot real & imag parts figure(2); clf hold on plot(r,real(poly),'k') plot(r,imag(poly),'b') % fancy title using a string variable words = ['\bf real & imag parts of P(x) along arg(z) = ' num2str(ang)]; title(words) xlabel('\bf r-axis') ylabel('\bf real(P(z)) (black) & imag(P(z)) (blue)') figure(1) plot(real(z),imag(z),'r')