I am calculating capacitor voltage and current. Now I want to determine the energy also. Energy is just the integral of power, however I cannot integrate my power function:

```
I_C=exp(-alpha*t).*(x5(1)*cos(omega_d*t)+x5(2)*sin(omega_d*t));
V_C=exp(-alpha*t).*(x6(1)*cos(omega_d*t)+x6(2)*sin(omega_d*t))+V_In; 
Pow_C=V_C.*I_C;
Pow_C_Function=@(t)Pow_C;
Energy_C=quad(Pow_C,0,tf)

```

I get the error: The integrand function must return an output vector of the
same length as the input vector.

Can anyone help?