As in the post above, too many things could show this symptom. If you have a code reader, the best thing is to read the code or get it read to point in the right direction (post the code here for further help). You can also try, starting from the easiest, and items that do not require much expense:
Through in a bottle of Techron into the fuel tank and see if anything improves- it would clean up the fuel system, including valves and fuel injectors.
Then, try cleaning the mass air flow sensor (two screws on the airbox) with a MAF cleaner.
Dirty vanos solenoid would be the next item (there is a DIY here).
Spark Plugs would be next.