
filename = {
    'stft_428_notds.mat'
    'stft_439_notds.mat'
    'stft_461_notds.mat'
    'stft_462ex_notds.mat'
    'stft_TJ049sz1.mat'
    'stft_TJ049sz2.mat'
    'stftwork_487038.mat'
    'stftwork_487044.mat'
    'stftwork_489000.mat'
    'stftwork_498030.mat'
 };
time = 200;

for ff = 1:length(filename)
    load(filename{ff});
    if ff == 1
         for cc = 1:length(stft_plus)
         ps = cell2mat(stft_plus(cc).stft(1,4));
        ps = ps*1000/mean(mean(ps));
         std_O = std(ps);
            if cc== 1

              std_avg = std_O;
             else
              std_avg = std_avg +std_O;
             end
          %figure
          %image(cell2mat(stft_plus(cc).stft(1,4)));
            %set(gca,'ydir','normal');
        end
        std_avg = std_avg/length(stft_plus);
        std_overall = std_avg;
        
    else
        for cc = 1:length(stft_plus)
         ps = cell2mat(stft_plus(cc).stft(1,4));
         ps = ps*1000/mean(mean(ps));
        disp(ps(10,100))
         std_O = std(ps);
            if cc== 1

              std_avg = std_O;
             else
              std_avg = std_avg +std_O;
             end
          %figure
          %image(cell2mat(stft_plus(cc).stft(1,4)));
            %set(gca,'ydir','normal');
        end
        std_avg = std_avg/length(stft_plus);

        std_overall = std_overall + std_avg;
        
    end
    
    %plot(1:length(std_avg), std_avg)
    %title(filename{ff})
end

load('stft_462sz11.mat')
ps = cell2mat(stft_plus(cc).stft(1,4));
disp(ps(10,100))
std_O = std(ps);
w = length(ps(1,:));
std_O = [zeros(1, length(std_overall(1,:))-length(std_O(1,:))) std_O];
std_overall(:,1:  (length(std_overall(1,:))-w)) = std_overall(:,1:(length(std_overall(1,:))-w))/length(filename);
std_overall(:,(length(std_overall(1,:))-w+1):end) = std_overall(:,(length(std_overall(1,:))-w+1):end)/(length(filename)+1);

A= figure;
plot(1:length(std_overall)-70, std_overall(:,1:1900))
title('Mean Standard Deviation of Power')
ylabel('Standard Deviation')
xlabel('Time (s)')
set(gca, 'XTick', [200:200:1800])
set(gca, 'XTickLabel', [-160:20:0])
hold on
x = zeros(1,30001);
x(:,:) = 1800;
plot(x, [0:30000], 'r')
saveas(A, 'StdDev.jpeg', 'jpeg')