美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx

上传人:b****2 文档编号:823624 上传时间:2023-04-29 格式:DOCX 页数:21 大小:18.01KB
下载 相关 举报
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第1页
第1页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第2页
第2页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第3页
第3页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第4页
第4页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第5页
第5页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第6页
第6页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第7页
第7页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第8页
第8页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第9页
第9页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第10页
第10页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第11页
第11页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第12页
第12页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第13页
第13页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第14页
第14页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第15页
第15页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第16页
第16页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第17页
第17页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第18页
第18页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第19页
第19页 / 共21页
美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx_第20页
第20页 / 共21页
亲,该文档总共21页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx

《美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx(21页珍藏版)》请在冰点文库上搜索。

美赛A题基于某NS模型的超车模型Matlab代码新鲜出炉Word格式文档下载.docx

n=128;

%initializethearrays

z=zeros(n,n);

cells=z;

sum=z;

%setafewcellstoone

cells(n/2,.25*n:

.75*n)=1;

cells(.25*n:

.75*n,n/2)=1;

%cells(.5*n-1,.5*n-1)=1;

%cells(.5*n-2,.5*n-2)=1;

%cells(.5*n-3,.5*n-3)=1;

cells=(rand(n,n))<

.5;

%howlongforeachcasetostabilityorsimpleoscillators

%buildanimageanddisplayit

imh=image(cat(3,cells,z,z));

set(imh,'

erasemode'

none'

axisequal

axistight

%indexdefinitionforcellupdate

x=2:

n-1;

y=2:

%Maineventloop

stop=0;

%waitforaquitbuttonpush

run=0;

%waitforadraw

freeze=0;

%waitforafreeze

while(stop==0)

if(run==1)

%nearestneighborsum

sum(x,y)=cells(x,y-1)+cells(x,y+1)+...

cells(x-1,y)+cells(x+1,y)+...

cells(x-1,y-1)+cells(x-1,y+1)+...

cells(3:

n,y-1)+cells(x+1,y+1);

%TheCArule

cells=(sum==3)|(sum==2&

cells);

%drawthenewimage

set(imh,'

cdata'

cat(3,cells,z,z))

%updatethestepnumberdiaplay

stepnumber=1+str2num(get(number,'

));

set(number,'

num2str(stepnumber))

end

if(freeze==1)

run=0;

freeze=0;

drawnow%needthisintheloopforcontrolstowork

end

2、SurfaceTension

%Conway'

slifewithGUI

clf;

clearall

%=============================================

%buildtheGUI

%definetheplotbutton

n,y-1)+cells(x+1,y+1)+...

cells(x,y);

cells=~((sum<

4)|(sum==5));

set(imh,'

3、PercolationCluster

%PercolationCluster

clf

clearall

threshold=.63;

%

ax=axes('

units'

pixels'

[11500400],'

color'

k'

text('

[50,255,0],...

BioNB'

w'

fontname'

helvetica'

100)

[120,120,0],...

441'

initial=getframe(gca);

[a,b,c]=size(initial.cdata);

z=zeros(a,b);

cells=double(initial.cdata(:

:

1)==255);

visit=z;

imh=image(cat(3,z,cells,z));

%return

fori=1:

100

sum(2:

a-1,2:

b-1)=cells(2:

a-1,1:

b-2)+cells(2:

a-1,3:

b)+...

cells(1:

a-2,2:

b-1)+cells(3:

a,2:

b-1)+...

a-2,1:

b-2)+cells(1:

a-2,3:

a,1:

b-2)+cells(3:

a,3:

b);

pick=rand(a,b);

%edgesonly

%cells=(cells&

(sum<

8))|((sum>

=1)&

(pick>

=threshold)&

(visit==0));

cells=cells|((sum>

visit=(sum>

=1);

%&

(pick<

threshold);

cat(3,z,cells,z))

drawnow

return

figure

(2)

image(cat(3,z,cells,z))

4、Excitablemedia(BZreactionorheart)

%CAdriver

%excitablemedia

z=zeros(n,n);

cells=z;

.1;

%cells(n/2,n*.25:

n*.75)=1;

%cells(n*.25:

n*.75,n/2)=1;

sum=z;

x=[2:

n-1];

y=[2:

t=6;

%centervalue=6;

7makesfastpattern;

5analiatingwaves

t1=3;

%centervalue=3

1200

sum(x,y)=((cells(x,y-1)>

0)&

(cells(x,y-1)<

t))+((cells(x,y+1)>

(cells(x,y+1)<

t))+...

((cells(x-1,y)>

(cells(x-1,y)<

t))+((cells(x+1,y)>

(cells(x+1,y)<

((cells(x-1,y-1)>

(cells(x-1,y-1)<

t))+((cells(x-1,y+1)>

(cells(x-1,y+1)<

((cells(x+1,y-1)>

(cells(x+1,y-1)<

t))+((cells(x+1,y+1)>

(cells(x+1,y+1)<

t));

cells=((cells==0)&

(sum>

=t1))+...

2*(cells==1)+...

3*(cells==2)+...

4*(cells==3)+...

5*(cells==4)+...

6*(cells==5)+...

7*(cells==6)+...

8*(cells==7)+...

9*(cells==8)+...

0*(cells==9);

cat(3,z,cells/10,z))

drawnow

5、ForestFire

%forestfire

n=100;

Plightning=.000005;

Pgrowth=.01;

%.01

o=ones(n,n);

veg=z;

imh=image(cat(3,z,veg*.02,z));

%burning->

empty

%green->

burningifoneneigborburningorwithprob=f(lightning)

%empty->

greenwithprob=p(growth)

%veg={empty=0burning=1green=2}

3000

%nearbyfires?

sum=(veg(1:

n,[n1:

n-1])==1)+(veg(1:

n,[2:

n1])==1)+...

(veg([n1:

n-1],1:

n)==1)+(veg([2:

n1],1:

n)==1);

veg=...

2*(veg==2)-((veg==2)&

0|(rand(n,n)<

Plightning)))+...

2*((veg==0)&

rand(n,n)<

Pgrowth);

cat(3,(veg==1),(veg==2),z))

6、Gasdynamics

%HPP-gas

nx=52;

%mustbedivisibleby4

ny=100;

z=zeros(nx,ny);

o=ones(nx,ny);

sand=z;

sandNew=z;

gnd=z;

diag1=z;

diag2=z;

and12=z;

or12=z;

sums=z;

orsum=z;

gnd(1:

nx,ny-3)=1;

%rightgroundline

nx,3)=1;

%leftgroundline

gnd(nx/4:

nx/2-2,ny/2)=1;

%theholeline

gnd(nx/2+2:

nx,ny/2)=1;

gnd(nx/4,1:

ny)=1;

%topline

gnd(3*nx/4,1:

ny)=1;

%bottomline

%filltheleftside

r=rand(nx,ny);

sand(nx/4+1:

3*nx/4-1,4:

ny/2-1)=r(nx/4+1:

ny/2-1)<

0.3;

%sand(nx/4+1:

3*nx/4-1,ny*.75:

ny-4)=r(nx/4+1:

ny-4)<

0.75;

%sand(nx/2,ny/2)=1;

%sand(nx/2+1,ny/2+1)=1;

imh=image(cat(3,z,sand,gnd));

1000

p=mod(i,2);

%margolisneighborhood

%upperleftcellupdate

xind=[1+p:

2:

nx-2+p];

yind=[1+p:

ny-2+p];

%Seeifexactlyonediagonalisones

%only(atmost)oneofthefollowingcanbetrue!

diag1(xind,yind)=(sand(xind,yind)==1)&

(sand(xind+1,yind+1)==1)&

...

(sand(xind+1,yind)==0)&

(sand(xind,yind+1)==0);

diag2(xind,yind)=(sand(xind+1,yind)==1)&

(sand(xind,yind+1)==1)&

(sand(xind,yind)==0)&

(sand(xind+1,yind+1)==0);

%Thediagonalsbothnotoccupiedbytwoparticles

and12(xind,yind)=(diag1(xind,yind)==0)&

(diag2(xind,yind)==0);

%Onediagonalisoccupiedbytwoparticles

or12(xind,yind)=diag1(xind,yind)|diag2(xind,yind);

%foreverygasparticleseeifitneartheboundary

sums(xind,yind)=gnd(xind,yind)|gnd(xind+1,yind)|...

gnd(xind,yind+1)|gnd(xind+1,yind+1);

%celllayout:

%x,yx+1,y

%x,y+1x+1,y+1

%If(nowalls)and(diagonalsarebothnotoccupied)

%thenthereisnocollision,somoveoppositecelltocurrentcell

%If(nowalls)and(onlyonediagonalisoccupied)

%thenthereisacollisionsomoveccwcelltothecurrentcell

%If(awall)

%thendon'

tchangethecell(causesareflection)

sandNew(xind,yind)=...

(and12(xind,yind)&

~sums(xind,yind)&

sand(xind+1,yind+1))+...

(or12(xind,yind)&

sand(xind,yind+1))+...

(sums(xind,yind)&

sand(xind,yind));

sandNew(xind+1,yind)=...

sand(xind,yind))+...

sand(xind+1,yind));

sandNew(xind,yind+1)=...

sand(xind+1,yind))+...

sand(xind+1,yind+1))+...

sand(xind,yind+1));

sandNew(xind+1,yind+1)=...

~sums(xind,yin

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2