% Evaluate MarinLab wave gauge data from Njord Runtime % GS 2017-03-30 clear all close all % choose wave gauge number to plot, (1 if only one installed) nr=1; % Set to 1 if only one gauge installed in tank wavefile=['../wavedata/jonswap1.txt']; % Enter correct file directory w=readgauge(wavefile) % w is a matlab struct, described in readgauge.m % If you want to cut data this is the start and end index: iws=1; % index wstart (set to 1 at start) iwe=length(w.time); % index wend (set to length(w.time) at start) % Zero data around oscillation center wtime=w.time(iws:iwe)-w.time(iws); % zeroed to start at t=0 s. wdata=w.gauges(iws:iwe,nr)-mean(w.gauges(iws:iwe,nr)); % zeroed, choose gauge number column (1 if only one active) % Plot wave data figure(1) plot(wtime,wdata) hy10=ylabel('Wave amplitude [m]'); hx10=xlabel('Time [s]'); set([hx10,hy10],'fontsize',12) set(gca,'fontsize',12) % if you want to print the figure for your report, uncomment the following % and rename to what you want %print -dpdf wave.pdf %print -dpng wave.png