LAB REPORT

# LAB REPORT - 2.1 function [data, count] =...

This preview shows pages 1–3. Sign up to view the full content.

2.1 function [data, count] = readbuoydata(datafile) fid = fopen(datafile, 'r' ); %Open datafile tline = fgetl(fid); %Read next line of file tline = fgetl(fid); %Read next line of file [A,count] = fscanf(fid, '%d %d %d %d %d %f %f %d %f %f' ,[10 inf]); %Read file and convert into array A. Count is te number of successful reads data.date = datenum([A(1:5,:); zeros(1,size(A,2))]')'; %Convert date/time in specified vectors data.Hs = A(6,:); % Assign 6 th column of array as Hs data.Tp = A(7,:); % Assign 7 th column of array as Hs data.Dp = A(8,:); % Assign 8 th column of array as Hs data.Ta = A(9,:); % Assign 9 th column of array as Hs data.SST = A(10,:); % Assign 10 th column of array as Hs fclose(fid); 2.2 subplot(2,1,1); plot(data.date,data.Hs); datetick( 'x' ,6) xlabel( 'Time' ) ylabel( 'Period' ) subplot(2,1,2); plot(data.date,data.Tp); xlabel( 'Time' ) ylabel( 'Period' ) datetick( 'x' ,6)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2.3 function y=mafilt(N,x) for n= N:length(X), y(n)=sum(X(n-2:n))/N; end end 2.4 avgdata=mafilt(5,data.Tp);
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/01/2011 for the course ANTHRO 5 taught by Professor Gaulin during the Spring '11 term at San Diego.

### Page1 / 6

LAB REPORT - 2.1 function [data, count] =...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online