%% Replot TFPlot, PSD2, nPSD2 PlotFigureType=1; % 1=TFPLot_PSDY1Y2+Coh 2=PSD2 3=nPSD2 LoadTFPMatFile=1; % if 1, reload Coherence_PSD_Profiles%Results.mat TFPlotGraphAxis=[-Inf,Inf,0,50]; CaxisPSDY1=[0,800]; CaxisPSDY2=[0,300]; CaxisCoh=[0,1]; LoadMatFile=0; % if 1, reload Mean_PSD_new2.mat %PSD2 GraphAxis=[-Inf,Inf,0,100]; Sig1PlotLimit=[0,100,0,15000]; Sig2PlotLimit=[0,100,0,4]; CohPlotLimit=[0,0.8]; %nPSD2 nSig1PlotLimit=[0,100,0,3]; nSig2PlotLimit=[0,100,0,0.5]; nCohPlotLimit=[0,0.8]; %% Main function if LoadMatFile==1; load('Mean_PSD_new2.mat'); end if PlotFigureType==2; figure(1); subplot(3,1,1); h11=plot(FreqCoh ,meanPSDY1); title(['PSD (Sig1) ' Title1]); xlabel('Frequency (Hz)'); ylabel('PSD (dB/Hz)'); axis(Sig1PlotLimit); legend(Legend); %set(h11(1),'Color',[0,0,1]); % Set the line 1 by RGB color [0 0 1] (blue) subplot(3,1,2); plot(FreqCoh ,meanPSDY2); title('PSD (Sig2)'); xlabel('Frequency (Hz)'); ylabel('PSD (dB/Hz)'); axis(Sig2PlotLimit); subplot(3,1,3); plot(FreqCoh ,meanCoh); title('PSD (Coh)'); xlabel('Frequency (Hz)'); ylabel('Coh'); axis([Sig2PlotLimit(1),Sig2PlotLimit(2),CohPlotLimit(1),CohPlotLimit(2)]); saveas(1,'PSD2.fig'); saveas(1,'PSD2.jpg'); end if PlotFigureType==3; figure(2); subplot(3,1,1); h21=plot(FreqCoh ,nmeanPSDY1); title(['PSD (Sig1) ' Title1]); xlabel('Frequency (Hz)'); ylabel('PSD (dB/Hz)'); axis(nSig1PlotLimit); legend(Legend); %set(h21(1),'Color',[0,0,1]); % Set the line 1 by RGB color [0 0 1] (blue) subplot(3,1,2); h22=plot(FreqCoh ,nmeanPSDY2); title('PSD (Sig2)'); xlabel('Frequency (Hz)'); ylabel('PSD (dB/Hz)'); axis(nSig2PlotLimit); set(h22(1),'Color',[0,0,1]); % Set the line 1 by RGB color [0 0 1] (blue) subplot(3,1,3); h23=plot(FreqCoh ,meanCoh); title('PSD (Coh)'); xlabel('Frequency (Hz)'); ylabel('Coh'); xlim([nSig2PlotLimit(1),nSig2PlotLimit(2)]); axis([nSig2PlotLimit(1),nSig2PlotLimit(2),CohPlotLimit(1),CohPlotLimit(2)]); set(h23(1),'Color',[0,0,1]); % Set the line 1 by RGB color [0 0 1] (blue) saveas(2,'nPSD2.fig'); saveas(2,'nPSD2.jpg'); end %% Replot TFPLot_PSDY1Y2+Coh.fig if PlotFigureType==1; if LoadTFPMatFile==1; load('Coherence_PSD_Profiles&Results.mat'); end figure(9); subplot(3,1,1); gca3=pcolor(TimeLable,FreqLable,PSDY1); set(gca3, 'LineStyle','none'); colorbar('location','eastoutside'); caxis(CaxisPSDY1); title([Title1]); ylabel('PSDY1(Hz)'); axis(TFPlotGraphAxis); subplot(3,1,2); gca3=pcolor(TimeLable,FreqLable,PSDY2); set(gca3, 'LineStyle','none'); colorbar('location','eastoutside'); caxis(CaxisPSDY2); ylabel('PSDY2(Hz)'); axis(TFPlotGraphAxis); subplot(3,1,3); gca=pcolor(TimeLable,FreqLable,Coh); set(gca, 'LineStyle','none'); colorbar('location','eastoutside'); xlabel('Time (seconds)'); ylabel('Coh(Hz)'); caxis(CaxisCoh); axis(TFPlotGraphAxis); saveas(9,'TFPLot_PSDY1Y2+Coh.fig'); saveas(9,'TFPLot_PSDY1Y2+Coh.jpg'); end