How to use user-defined functions in the Manipulate function to be exported as CDF

Wrap the plot command with DynamicModule, and define your functions in the Initialization option.