function [freq,signal]=HPpower(filename); % % Read in power spectra files which have been saved on the HP3536A and converted to % PC-readable format by 63x_mx.bat from the /lifutil folder on Bob's Desktop. % % returns freq = array of frequencies measured at % signal = power spectrum, in Volts(rms) % % data will NOT be normalised by root Hz if 63x_mx.bat was used. % % (Modified by Dave Bonfield from HPread.m, which was supplied by AJW) % fid = fopen(filename,'r'); % % three header lines, which contain the # of data points: t1 = fgetl(fid); t2 = fgetl(fid); t3 = fgetl(fid); [q1 N q3 q4] = strread(t3,'%s%d%d%s'); % % "N" should now be the number of data points measured % % Now read in the frequencies measured at freq = fscanf(fid,'%f'); % now a comment line, also containing the # of data points: t4 = fgetl(fid); [q1 N q3 q4] = strread(t4,'%s%d%d%s'); % % now the signal - in whatever units the batch file used for conversion has made them % - for 63x_mx.bat this seems to be unnormalised, i.e. NOT per root Hz, Volts(rms). signal = fscanf(fid,'%f', N); % % close the file: fclose(fid); % return;