You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.0 KiB
116 lines
3.0 KiB
function plot_ellipse_new(aPhys,bPhys,cPhys)
|
|
% load('ani_rmin1.5_cab.mat','a_log','b_log','c_log')
|
|
% aPhys=a_log{493,2};bPhys=b_log{493,2};cPhys=c_log{493,2};
|
|
% load('ani_rmin1.5_cab_newfilter.mat')
|
|
nz=size(aPhys,1);ny=size(aPhys,2);nx=size(aPhys,3);
|
|
figure()
|
|
% min(min(min(aPhys)))
|
|
% max(max(max(aPhys)))
|
|
%
|
|
% min(min(min(bPhys)))
|
|
% max(max(max(bPhys)))
|
|
j=1;
|
|
for i=1:nx
|
|
% for j=1:ny
|
|
for k=1:nz
|
|
a = (aPhys(k,j,i)-0.0)/2;
|
|
b = (bPhys(k,j,i)-0.0)/2;
|
|
% c=0.35;
|
|
% c = (cPhys(k,j,i)+0.6);%Ó¦¸Ã´óÓÚ1²Å»áÔ½´ó
|
|
c = (cPhys(k,j,i)+5)/6;
|
|
% c = 0.5*(cPhys(k,j,i)+1.7)/3.4;
|
|
% rectangle('Position',[i-1+0.5-a/2,k-1+0.5-b/2,a,b],...
|
|
% 'Curvature',[1,1],...
|
|
% 'FaceColor',[0 1 0].*(1-c)+[0 0 1].*c,...
|
|
% 'EdgeColor',[0 1 0].*(1-c)+[0 0 1].*c);
|
|
|
|
rectangle('Position',[i-1+0.5-a/2,k-1+0.5-b/2,a,b],...
|
|
'Curvature',[1,1],...
|
|
'FaceColor',[1 1 1].*0.9*c,...
|
|
'EdgeColor',[1 1 1].*0.9*c);
|
|
% 'FaceColor',[1 0 0].*(1-c)+[0 1 0].*c,...
|
|
% 'EdgeColor',[1 0 0].*(1-c)+[0 1 0].*c);
|
|
% 'FaceColor',[0 1 0].*(1-c)+[1 0 0].*c,...
|
|
% 'EdgeColor',[0 1 0].*(1-c)+[1 0 0].*c);
|
|
|
|
|
|
|
|
% rectangle('Position',[i-1+0.5-a/2,k-1+0.5-b/2,a,b],...
|
|
% 'Curvature',[1,1],'FaceColor',[18 184 246]./256)
|
|
% rectangle('Position',[i-1+0.5-c/2,k-1+0.5-c/2,c,c],...
|
|
% 'Curvature',[1,1],'FaceColor',[18 184 246]./256)
|
|
hold on;
|
|
end
|
|
% end
|
|
end
|
|
axis equal;axis tight;axis off;
|
|
|
|
|
|
% map = [1.0 0.0 0;
|
|
% 0.8 0.2 0;
|
|
% 0.6 0.4 0;
|
|
% 0.4 0.6 0;
|
|
% 0.2 0.8 0;
|
|
% 0.0 1.0 0];
|
|
% map = [linspace(1,0,51).',linspace(0,1,51).',zeros(51,1)];colormap(map);
|
|
map = [linspace(0,0.9,51).',linspace(0,0.9,51).',linspace(0,0.9,51).'];colormap(map);
|
|
% colorbar
|
|
hold on
|
|
|
|
line([0 0],[0 20],'Color','black')
|
|
line([60 60],[0 20],'Color','black')
|
|
line([0 60],[0 0],'Color','black')
|
|
line([0 60],[20 20],'Color','black')
|
|
draw_frame_2d();
|
|
end
|
|
function draw_frame_2d()
|
|
[MESH,V_macro]=MeshGenerate_2D_rectangle(61,21);
|
|
|
|
num_ele=size(MESH,1);
|
|
for iele=1:num_ele
|
|
ele=MESH(iele,:);
|
|
for i=1:4
|
|
if i==4
|
|
lin=[4 1];
|
|
else
|
|
lin=[i i+1];
|
|
end
|
|
vidx=ele(lin);
|
|
vcoor=V_macro(vidx,:);
|
|
% vcoor
|
|
line([vcoor(1,1) vcoor(2,1)],[vcoor(1,2) vcoor(2,2)],...
|
|
'Color','k','LineStyle',':')
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
function [MESH,V]=MeshGenerate_2D_rectangle(width,height)
|
|
h=1.0;
|
|
%Node
|
|
V=zeros(width*height,2);
|
|
NodeIdx=zeros(width,height);
|
|
index=1;
|
|
for i=1:width
|
|
for j=1:height
|
|
V(index,1)=(i-1)*h;
|
|
V(index,2)=(j-1)*h;
|
|
NodeIdx(i,j)=index;
|
|
index=index+1;
|
|
end
|
|
end
|
|
%Mesh
|
|
nele=(width-1)*(height-1);
|
|
MESH=zeros(nele,4);
|
|
|
|
index=1;
|
|
for i=1:width-1
|
|
for j=1:height-1
|
|
MESH(index,1)=NodeIdx(i,j);
|
|
MESH(index,2)=NodeIdx(i+1,j);
|
|
MESH(index,3)=NodeIdx(i+1,j+1);
|
|
MESH(index,4)=NodeIdx(i,j+1);
|
|
index=index+1;
|
|
end
|
|
end
|
|
end
|