-
Notifications
You must be signed in to change notification settings - Fork 0
/
VP1D4f_AnalyzeData.m
75 lines (70 loc) · 3.07 KB
/
VP1D4f_AnalyzeData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
function VP1D4f_AnalyzeData
%%
%% Last modified by Cristel Chandre (November 4, 2021)
%% Comments? cristel.chandre@cnrs.fr
%%
[filename, path] = uigetfile('*.mat');
load([path filename],'data','output_modes','Lx','kappa','precision')
P0 = 1;
rho0 = 1;
Nx = length(data(1,:))-1;
d = data(2,1)-data(1,1);
data = data(1:2*floor(length(data(:,1))/2),:);
Nt = length(data(:,1));
if strcmp(output_modes,'real')==true
figure
imagesc(data(:,1),linspace(-1,1,Nx),data(:,2:end).')
shading flat
cmap1 = 1-hot(256);
cmap2 = flipud(hot(256));
colormap([flip(cmap1(2:end,:));cmap2])
colorbar
xlabel('$\omega_p t$','interpreter','latex','FontSize',26)
ylabel('$x/L_x$','interpreter','latex','FontSize',26)
set(gca,'box','on','FontSize',20,'LineWidth',2,'YDir','normal')
figure
fft_data = fftshift(fft2(data(:,2:end).'));
fft_data(abs(fft_data)<=precision*max(abs(fft_data(:)))) = NaN;
kx = pi/Lx*(-Nx/2:Nx/2-1);
om = 2*pi*(-Nt/2:Nt/2-1)/(Nt*d);
imagesc(om,kx,log10(abs(fft_data)))
colormap(flipud(pink))
colorbar
xlim(2*pi*[-200 200]/(Nt*d))
ylim([-10 10]*pi/Lx)
caxis([log10(precision) log(max(abs(fft_data(:))))])
xlabel('$\omega$','interpreter','latex','FontSize',26)
ylabel('$k_x$','interpreter','latex','FontSize',26)
set(gca,'box','on','FontSize',20,'LineWidth',2,'YDir','normal')
hold on
lam02 = 1+3*double(kappa)*P0^(2/3)/rho0*kx.^2;
lambg2 = 1+3*P0/rho0^2*kx.^2;
lam = sqrt(lam02-sqrt(lam02.^2-4*(lam02-lambg2)))/sqrt(2);
plot(lam(imag(lam)==0), kx(imag(lam)==0), 'o', 'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',10)
plot(-lam(imag(lam)==0), kx(imag(lam)==0), 'o', 'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',10)
lam = sqrt(lam02+sqrt(lam02.^2-4*(lam02-lambg2)))/sqrt(2);
plot(lam(imag(lam)==0), kx(imag(lam)==0), 'o', 'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',10)
plot(-lam(imag(lam)==0), kx(imag(lam)==0), 'o', 'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',10)
elseif isinteger(output_modes)==true
for it=3:output_modes-1
semilogy(data(:,1),abs(data(:,it)),'LineWidth',2,'DisplayName',strcat('$k=$ ',' ',num2str(it-2)))
hold on
end
legend('interpreter','latex')
xlabel('$\omega_p t$','interpreter','latex','FontSize',26)
set(gca,'box','on','FontSize',20,'LineWidth',2)
end
%
% Copyright (c) 2021 Cristel Chandre.
% All rights reserved.
%
% Redistribution and use in source and binary forms are permitted provided
% that the above copyright notice and this paragraph are duplicated in all
% such forms and that any documentation, advertising materials, and other
% materials related to such distribution and use acknowledge that the
% software was developed by the CNRS. The name of the CNRS may not be used
% to endorse or promote products derived from this software without
% specific prior written permission.
% THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
% WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.