Changing analogWrite() function frequency

That is true. But watch out for other libraries that use other timers. It is not always easy to spot what hardware resources are used, especial third party ones. They often have poor documentation.

So if you have no other library loaded fell free to use either timer 1 or timer 2. But if later down the line with your project you might have to change the timer you used for the PWM speed. Or edit and change the other library.