I purchased some flak guns for my ship and they are supposedly good against fighters and missiles. However when I shoot them they seem to just head straight out the sides of my ship not really aimed at anything. How do I actually hit an incoming missile with them?
I found the flak cannons to be completely ineffective against torpedos and mines, however the energy absorbing deflectors work well enough as a countermeasure to these.
When dealing with ordinary missiles, flak seems to be most effective whilst your ship is at full speed and most importantly steering away from a broadside encounter.
Try to position your ship so that the missiles are not directly behind you but just offset to the rear, as when you are in motion this puts more flak fire directly in the path of missiles.
The exact angle differs per ship but as you look behind you, you'll be able to see where the flak is exploding and adjust the the angle to keep missile trajectory running through the same area.
It is possible to orient the ship so that the the flak explosions destroy the incoming rockets, but in the heat of the battle its much more realistic to just keep spamming the secondary and hope it hits something. The ammo of for the Flak secondary is unlimited and the fire rate is rather high, so you can just keep the secondary fire button pressed during a whole battle, also because the flak projectiles explode, you don't need pinpoint accuracy.
There is not much you can do against incoming missiles, your best option is a good deflector. There is also an Ordnance Targeting subsystem, that lets you manually target incoming torpedoes and mines (with turrets), but trying to hunt down missiles one-by-one in a battle is just suicide, it's only useful in less hectic situations, like clearing minefields.