data_treatment.m 1.11 KB
clear all;
close all;


x=ncread('simulation1.nc','x_axis');
t=ncread('simulation1.nc','time');
om=ncread('simulation1.nc','omega');
spectre=ncread('simulation1.nc','Spectrum');
Dave=ncread('simulation1.nc','Dave');
Dmax=ncread('simulation1.nc','Dmax');


f=om/(2*pi);
E=reshape(spectre(end,end,:),length(om),1);
Ei=reshape(spectre(30,:,:),length(x),length(om));
E1=reshape(spectre(1,1,:),length(om),1);





figure(1)
cmap=rand(length(t),3);
  w = waitforbuttonpress;
for i=1:length(t)
    
    figure(1)
    
    sp=reshape(spectre(i,:,:),length(x),length(om));
    h=mesh(f,x,sp);
    axis([min(f) max(f) min(x) max(x) 0 max(E1)])
         xlabel('Frequency [s^{-1}]')
        zlabel('Energy')
   
    ylabel('x [km]')
   pause(0.1)
  
end
    
for i=1:length(om)
    EE(i)=sum(Ei(:,i));
    
end
figure
plot(E1)
hold on
plot(EE,'r')

for i=1:length(t)
    
E2=reshape(spectre(i,:,:),length(x),length(om));
m0(i)=sum(sum(E2))/sum(E1);
end
figure
plot(t,m0)






figure


 
 plot(x,Dmax,'color','r')
    hold on
    plot(x,Dave,'--b')
    grid on
    
     xlabel('x [km]')
    ylabel('Floe size [m]')
    
    legend('Dmax','<D>')