Need to know the detail for answering this question. However, assuming that the system under consideration is the simplest one (classical model with second order generator representation) you may go through the following steps:
1. Obtain the initial values of delta and omega for a given operating condition. This would be your main file in MATLAB.
2. Prepare another function file comprising of the state equations (in this case only TWO) and the disturbance scenario.
3. Use ODE solver ode45 for solving your system and plot the results (from your main File of step 1).
I have data for the speed of the generator(get it from the software where I built my model in) ,and I integrate it using cumtrapz in matlab but the results are not right, any ideas?