This is a very nice, well commented and well structured code!
Your comments in the start are exactly how they should be. You already know this, but writingI'll say it anyway. Writing a function like you've done, where you have comments like this in the start aids the user because help functionName gives youwill provide the information you need is very good practiceneeded in order to use the function.
There's is only one minor thing I would do differently. You know the end points, and how many steps there are. You have two options:
- Calculate the step-size and use it to create a vector with the correct number of steps using colon
- Just use what you know directly in linspace
Instead of calculating re_step and do reals = limits(1) : re_step : limits(2); you can use linspace:
reals = linspace(limits(1), limits(2), image_size(1));
imags = linspace(limits(4), limits(3), image_size(2));
I guess you know this, but yourThe following comment is technically incorrect: "% Transpose so that plot will have reals on the x axis"
You are working with complex numbers, and in those cases, ' is the complex conjugate transpose, not the transposeregular transpose. I don't know if you want the transpose or the complextcomplex conjugate transpose, but it's nice to keep in mind.