Navigation : Top/MATLAB Practice 6

Read/write data + Fourier analysis

  • Read the -.mat data 'crf_wind.mat' and plot the first row component [u(1,:)]. u is the wind speed data and the dimension is [m/s], the horizontal axis is time, the increment is dt, and the dimension is [s].
    # load 
  • Load the text data 'crf_wind.dat', plot the first row component [u(1,:)], and compare it with u(1,:) in the .mat data. The data format of 'crf_wind.dat' is in Appendix 1.
    # fopen, fscanf, fclose 
    Calculate the spectrum of -u(1,:) and plot it on the logarithmic axis.
    # logloglog 
  • Save the computed values in matlab format
    # save

Data

Ref.

% Output format of crf_wind.dat
filename_tmp = strcat('filename_w','.dat')
fid = fopen( 'crf_wind.dat', 'w' )
fprintf( fid, '%5d %5d\n', nt, nz )
fprintf( fid, '%12.5e\n', dt )
fprintf( fid, '%12.5e', z(1:nz) )
fprintf( fid, '\n' );
for iz=1:nz
  fprintf( fid, '%12.5e', u(iz,:) ); for iz=1:nz
  fprintf( fid, '\n' );
end
fclose(fid);