complex plots bug?
Show older comments
Am I doing something wrong or is this a bug in Matlab plotting?
Set up nested for loops to iterate through the real and complex values in the complex plane and evaluate a function on the complex domain for some criteria. Use real(z^2) > 0 as an example. Plot any z values that meet the real(z^2) > 0 criteria.
The resulting plots have the following 2 bugs: a phantom vertical line at Real value 1 and no points plot along the real axis. Command line testing of the evaluation shows that matlab is correctly executing the function and reporting the correct values, so it seems to be something in the handoff to the plot engine (maybe??). Is there some known way to work around this?
Example code:
%------------------------------------------------------------------------------------------------------------------------------------------------------------------
clf
hold on
grid on
xlim([-5 5])
ylim([-5,5])
disp("starting job...")
for zx=-5:.1:5
for zy=-5:.1:5
z=zx+zy*i; %compose z from real and imag parts
if(real(z^2)>0) %sample function evaluation criteria
plot(z,'b.') % bug has plots showing a vertical line at re(1) and no points on the real axis.
end
end
end
disp("job complete")
sample output:

Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!