Assuming that the spectograms are already available, we can calculate the 'Power Spectral Density' (PSD) for each spectogram since the "bandpower" function in MATLAB takes PSD as the first argument.
power = bandpower(PSD, fs, 'psd');
Next, to plot both these one below the other, we can use a combination of the "subplot" and "plot" functions along with the "grid" command in MATLAB. The "subplot" function helps divide the plotting plane according to our usage and the "grid" command helps to separately identify each graph. We can keep the x-coordinate in the "plot" function as 'p2' to make sure the graphs are plotted against the time vector.
Also, to label the axes and title the graph, we can use the "xlabel", "ylabel" and the "title" functions available in MATLAB.
For more details regarding the usage of each function discussed above, please refer to the documentation links below-
I hope the above explanation resolves your query.