Skip to main content
added 296 characters in body
Source Link
Stewie Griffin
  • 2.1k
  • 1
  • 18
  • 34

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:

  1. Calculate the step-size and use it to create a vector with the correct number of steps using colon
  2. 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.

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 writing a function like you've done, where help functionName gives you the information you need is very good practice.

There's is only one minor thing I would do differently.

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 your 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 transpose. I don't know if you want the transpose or the complext conjugate transpose, but it's nice to keep in mind.

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 I'll say it anyway. Writing a function where you have comments like this in the start aids the user because help functionName will provide the information needed 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:

  1. Calculate the step-size and use it to create a vector with the correct number of steps using colon
  2. 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));
 

The following comment is 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 regular transpose. I don't know if you want the transpose or the complex conjugate transpose, but it's nice to keep in mind.

Source Link
Stewie Griffin
  • 2.1k
  • 1
  • 18
  • 34

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 writing a function like you've done, where help functionName gives you the information you need is very good practice.

There's is only one minor thing I would do differently.

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 your 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 transpose. I don't know if you want the transpose or the complext conjugate transpose, but it's nice to keep in mind.