Mindon.IDEA

Air off, Mind on ~ / Javascript+Golang, Sci, Health… /

Lake Pollution Distribution (MATLAB)

BlogMS original blog key: 1000141876, blog id: airoff History stat: 浏览/评论:166/0 , 日期:2005年1月7日 09:43

file lake0.m: x - y distribution


%lake0(m,num)

%m decides how smooth the curve you want to be.

%num decides how many countors you want to show.

%example:lake0(160,20)

function lake0(m,num)

%all known parameters setup

n=6;

%u0=3.854167;

%c0=0.599653;

u0=0;

c0=7.195833;

c=[-0.121111 -0.000089 -0.233839 -0.114921 0.015436 -0.368833];

d=[0.033955 -0.034494 -0.017328 -0.086451 0.073220 0.000013];

r=0:1/m:1.0;

thita=0:2pi/m:2pi;

%Initalize the matrixs for higher speed

rp=(r(ones(size(thita)),:))‘;

thita=thita(ones(size®),:);

%clear useless vetor

clear r;

x=31rp.cos(thita);

y=31rp.sin(thita);

u=rp.(c(1)cos(thita)+d(1)*sin(thita));

for k=2:n

u=u+(rp.^k).(c(k)cos(kthita)+d(k)sin(k*thita));

end

%clear useless vetor

clear c d k n m;

clear rp thita;

u=u0+c0/2+u;%Final result

%define the color map

colormap(zeros(64,3));

grid off

axis equal,hold;

axis([-35 35 -35 35]);

set(gcf,‘Color’,[1 1 1]);

set(gca,‘Box’,‘on’,‘LineWidth’,1.5);

rAngle=pi;

xr=xcos(rAngle)+ysin(rAngle);

yr=-xsin(rAngle)+ycos(rAngle);

%[C,h]=contour(x,y,u,num);

[C,h]=contour(xr,yr,u,num);

%clear useless vetor

clear x y u;

title(‘湖水内部环境污染综合指标分布’);

xlabel(‘x (m)’);

ylabel(‘y (m)’);

%clabel©;

%clabel(C,h);

clabel(C,‘manual’);

hold off


file lake1.m: radiu - angle distribution


%lake1(m,num)

%m decides how smooth the curve you want to be.

%num decides how many countors you want to show.

%example:lake1(160,20)

function lake(m,num)

n=6;

%u0=3.854167;

%c0=0.599653;

u0=0;

c0=7.195833;

c=[-0.121111 -0.000089 -0.233839 -0.114921 0.015436 -0.368833];

d=[0.033955 -0.034494 -0.017328 -0.086451 0.073220 0.000013];

r=0:31/m:31.0;

thita=0:360/m:360;

rp=(r(ones(size(thita)),:))‘;

thita=thita(ones(size®),:);

u=(rp/31).(c(1)cos(thitapi/180)+d(1)sin(thita*pi/180));

for k=2:n

u=u+((rp/31).^k).(c(k)cos(k(thitapi/180))+d(k)sin(k(thita*pi/180)));

end

u=u0+c0/2+u;

colormap(zeros(64,3));

[C,h]=contour(thita,rp,u,num);

set(gcf,‘Color’,[1 1 1]);

set(gca,‘Box’,‘on’,‘LineWidth’,1.5);

set(h,‘LineWidth’,1.2);

title(‘湖水内部环境污染综合指标分布’);

ylabel(‘半径 r (m)’);

xlabel(‘角度 (度)’);

%clabel(C,h);

clabel(C,‘manual’);

hold off


Comments