Home > src > main > matlab > flaglet_plot_f.m

flaglet_plot_f

PURPOSE ^

SYNOPSIS ^

function flaglet_plot_f( f, varargin )

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function flaglet_plot_f( f, varargin )
0002 
0003 sz = size(f);
0004 N = sz(1);
0005 L = sz(2);
0006 
0007 p = inputParser;
0008 p.addParamValue('layer', 0, @isnumeric);
0009 p.addParamValue('L', L, @isnumeric);
0010 p.addParamValue('P', N, @isnumeric);
0011 p.parse(varargin{:});
0012 args = p.Results;
0013 
0014 if args.L > L || args.P > N
0015     nodes = slag_sampling(args.P, 1.0);
0016     f_ini = f;
0017     disp('flag analysis')
0018     f_lmp = flag_analysis(f_ini, 'R', 1.0, 'reality', true);
0019     f_lmp_zeropadded = zeros(N, args.L^2);
0020     f_lmp_zeropadded(1:N, 1:L^2) = f_lmp(:,:);
0021     disp('flag synthesis')
0022     f = flag_synthesis(f_lmp_zeropadded, 'Nodes', nodes, 'reality', true);
0023     L = args.L;
0024     N = args.P ;
0025 end
0026 
0027 [rs, thetas, phis] = flag_sampling(L, N, 1.0);
0028 thetas = pi/2 - thetas; 
0029 thetas = [ pi/2 thetas -pi-fliplr(thetas(1:L-1)) pi/2 ];
0030 [rs, thetas] = ndgrid(rs, thetas);
0031 x = rs .* cos(thetas);
0032 y = rs .* sin(thetas);
0033 
0034 %ind_neg = find(f < 0);
0035 %f(ind_neg) = f(ind_neg) / abs(min(min(min(f))));
0036  
0037 %ind_pos = find(f > 0);
0038 %f(ind_pos) = f(ind_pos) / max(max(max(f)));
0039 
0040 v_p0 = zeros(N,2*L+1);
0041 v_p0(:,1) = f(:,1,1);
0042 v_p0(:,2:(L+1)) = f(:,:,L);
0043 v_p0(:,(L+2):(2*L)) = fliplr(f(:,1:L-1,1));
0044 v_p0(:,2*L+1) = f(:,1,1);
0045 
0046 grid off
0047 hold on
0048 h = surface(x,y,zeros(size(x)),v_p0,'EdgeColor', 'none');
0049 %[C,h] = contourf(x, y, v_p0, nlevels,  'EdgeColor', 'none');
0050 rotate(h,[0 1 0],90)
0051 rotate(h,[1 0 0],90)
0052 
0053 
0054 v_p90 = zeros(N,2*L+1);
0055 v_p90(:,1) = f(:,1,floor(L/2));
0056 v_p90(:,2:(L+1)) = f(:,:,floor(3*L/2));
0057 v_p90(:,(L+2):(2*L)) = fliplr(f(:,1:L-1,floor(L/2)));
0058 v_p90(:,2*L+1) = f(:,1,floor(L/2));
0059 
0060 h = surface(x,y,zeros(size(x)),v_p90,'EdgeColor', 'none');
0061 %[C,h] = contourf(x, y, v_p90, nlevels,  'EdgeColor', 'none');
0062 rotate(h,[0 1 0],90)
0063 rotate(h,[0 0 1],90)
0064 rotate(h,[0 1 0],90)
0065 
0066 [rs, thetas, phis] = flag_sampling(L, N, 1.0);
0067 [rs, phis] = ndgrid(rs, [phis phis(1)]);
0068 x = rs .* cos(phis);
0069 y = rs .* sin(phis);
0070 v_t0 = zeros(N,2*L);
0071 for p=1:2*L-1
0072     v_t0(:,p) = f(:,floor(L/2),p);
0073 end
0074 v_t0(:,2*L) = f(:,floor(L/2),1);
0075 
0076 h = surface(x,y,zeros(size(x)),v_t0,'EdgeColor', 'none');
0077 %[C,h] = contourf(x, y, v_t0, nlevels,  'EdgeColor', 'none');
0078 rotate(h,[0 0 1], -90)
0079 
0080 view(45,45)
0081 colormap(hot(256))
0082 
0083 v = axis;
0084 %axis(0.75*v);
0085 axis off
0086 grid off
0087 
0088 rs_line = 1.0;
0089 thetas_line = 0:0.01:2*pi;
0090 [rs_line, thetas_line] = ndgrid(rs_line, thetas_line);
0091 xs_line = rs_line.*cos(thetas_line);
0092 ys_line = rs_line.*sin(thetas_line);
0093 line(xs_line,ys_line,zeros(size(xs_line)),'Color',[0 0 0])
0094 line(zeros(size(xs_line)), xs_line,ys_line,'Color',[0 0 0])
0095 line(xs_line,zeros(size(xs_line)), ys_line,'Color',[0 0 0])
0096 
0097 
0098 if args.layer ~= 0 && args.layer <= N+1
0099     layerofinterest = args.layer;
0100     v_sph = zeros(L, 2*L-1);
0101     v_sph(:,:) = f(layerofinterest,:,:);
0102 
0103     [rs, thetas, phis] = flag_sampling(L, N, 1.0);
0104     close = @(x) [x, x(:,1)];
0105     v_sph = close(v_sph);
0106     v_norm = (v_sph - min(min(v_sph)))/(max(max(v_sph))- min(min(v_sph)));
0107     thetas = close(thetas);
0108     phis = close(phis);
0109 
0110     [thetas, phis] = ndgrid(thetas, phis);
0111     [x, y, z] = ssht_s2c(thetas, phis, rs(layerofinterest));
0112     h = surf(x,y,z,v_sph);
0113     rotate(h,[0 0 1], -90)
0114     set(h, 'LineStyle', 'none')
0115     
0116     rs_line = rs(layerofinterest);
0117     thetas_line = 0:0.01:2*pi;
0118     [rs_line, thetas_line] = ndgrid(rs_line, thetas_line);
0119     xs_line = rs_line.*cos(thetas_line);
0120     ys_line = rs_line.*sin(thetas_line);
0121     line(xs_line,ys_line,zeros(size(xs_line)),'Color',[0 0 0])
0122     line(zeros(size(xs_line)), xs_line,ys_line,'Color',[0 0 0])
0123     line(xs_line,zeros(size(xs_line)), ys_line,'Color',[0 0 0])
0124 
0125     
0126 end
0127 
0128 colormap(hsv)
0129 
0130 camlight
0131 camlight(-80,10)
0132 material dull
0133 
0134 end

Generated on Mon 24-Sep-2012 12:26:33 by m2html © 2005