Integrate the product of four infinite series functions
Caveat: I am not a Matlab expert, nor am I competent at an advanced undergraduate level in mathematics.
Efficiency
Removing data structure impedance and redundant or unnecessary calculations is likely to improve the running time of the code under review.

func5 [whatever the func that is] is called twice with exactly the same arguments.

Each time it is wrapped in reshape which adds to the cost.

Indeed func1, func2, and func5 are defined each returning a data structure that requires reshaping. This can be avoided by either working with their data structure directly in the code under review or redefining the functions to return the data structure used by the code.

(n - m + i + k + p)*log(a/sig^2) is calculated twice. Sure in one location it needs to be doubled.

Each time through the inner loop (n - m + i + k + p) increases by one. There's no need to recalculate it in full. It can be passed as a parameter from the enclosing function.

a [defined elsewhere?] is a constant within the code under review. Therefore log(a/sig^2) is also a constant. Yet is being calculated twice in the inner loop.

(log sig) [sig defined elsewhere?] is calculated for each iteration at the each level of the loop. It's a constant.

There are probably other places where redundant computations can be avoided.


Code Clarity
The code is hard to read.
The more that the names of items in the code reflect the way we would label the pieces of the problem domain [mathematics here], the easier it becomes to reason about the way the code implements the problem.
sigma_k better expresses the mathematics than total1. And though I know temp = temp + ... does something, but it's not obvious what. function1_result = start_value + ... is better. partialgamma1_result = start_value + ... is better.
Final thoughts
Giving things meaningful names helps a lot. logsig = log(sig) seems like more work because it is more typing [by 8 more keystrokes]. But it's a false economy because debugging and refactoring code for speed is orders of magnitude more difficult than banging on the keyboard.