%Shane Crockett - 11 JUN 98 %Plot of instantaneous power vs. time % Power was determined by summing the columns of the spectrogram, and dividing by the number of elements in that column (numerical mean). %This was then plotted vs. time. The secondary peak is probably larger than expected because less energy was removed during the prewhitening. freqstep = 25/65; %newsig = (DChirp).*freqstep; ipwrtt = sum(DChirp).*(freqstep); pt = ((.32*10^-6)./2).*[1:length(ipwrtt)].*1000; %converts x scale to msec %plot(pt,ipwrtt) %xlabel('time(msec)') %ylabel('Power') %axis([0 max(pt) 0 max(ipwrtt)]) %title(filename) %set(gcf, 'Position', [50 25 400 350]) % Autocorrelates the power using circular autcorrelation acorr %acorr is an m.file G = ceil(length(auto)/4); auto = auto(G:G + ceil(G/2)); %creates vector of relevant data points auto = auto./max(auto); %scales the data between one and zero at = ((.32*10^-6)/2).*[1:length(auto)]*1000; %converts x scale to msec plot(at,auto) axis([0 max(at) min(auto) 1]) titl = ['Power-autocorrelation of ' filename]; title(titl) xlabel('Time (msec)') ylabel('Lagged Autocorrelation') % Determining background level % This is accomplished by sampling the last 10% of data points (assuming that no phenomena occur during this time) and taking the mean of this data. background = auto(length(auto) - round(.1*length(auto)):length(auto)); backbar = mean(background); % Statistical data. % Creates an output file to record the following statistics % Output file is named filename.txt where the filename is the name of the raw signal file name = [filename '.txt']; diary(name); fprintf(filename); fprintf(':\n'); %Optimally dechirped instantaneous power and Total Electron Content var = find(FOM == max(FOM)); fprintf('\nThe TEC is %g. \n',TEC(var)) fprintf('\nThe optimally dechirped average power is %g. \n',mean(ipwrtt)) % Determining the 1/e value. r = find(auto <= (1)/exp(1)); check = isempty(r); if check == 0 text(at(r(1)- 1), auto(r(1)-1), ' -1/e') fprintf('\nThe power-autocorrelation 1/e width is %g msec. \n', at(r(1) - 1)) % Calculating the Signal-to-Noise Ratio % Determining the amount of lag to the second peak and the value at that time. echo off findmax %executes an m.file named findmax SNR = 10*log(lagmax/backbar); if at(r(1)) <= .01 if SNR >= 5 fprintf('\nThe SNR is %g dB. \n',SNR) text(at(lag), lagmax, ' <--- local max - possible secondary') fprintf('\nThe lag is %g sec. \n',lag*(.32*10^-6)*.5) else end else end else end %Determining the Peak Power fprintf('\nThe peak power is %g. \n',max(ipwrtt)) % Determining Contrast (Peak-to-Median Power) fprintf('\nThe Contrast of the signature is %g. \n',max(ipwrtt)/median(ipwrtt)) fprintf('\n _____________________________________ \n\n'); diary off % Administrative to free space clear freqstep newsig pt auto at background backbar lagmax lag r ip pad u x