matlab 程序解释 急需

matlab 程序解释 急需,第1张

在这里:

function u = EVOLUTION(u0, g, lambda, mu, alf, epsilon, delt, numIter)

% EVOLUTION(u0, g, lambda, mu, alf, epsilon, delt, numIter) updates the level set function

% according to the level set evolution equation in Chunming Li et al's paper:

% "Level Set Evolution Without Reinitialization: A New Variational Formulation"

% in Proceedings CVPR'2005,

% Usage:

% u0: level set function to be updated

% g: edge indicator function

% lambda: coefficient of the weighted length term L(\phi)

% mu: coefficient of the internal (penalizing) energy term P(\phi)

% alf: coefficient of the weighted area term A(\phi), choose smaller alf

% epsilon: the papramater in the definition of smooth Dirac function, default value 15

% delt: time step of iteration, see the paper for the selection of time step and mu

% numIter: number of iterations

%

u=u0;

[vx,vy]=gradient(g);

for k=1:numIter

u=NeumannBoundCond(u);

[ux,uy]=gradient(u);

normDu=sqrt(ux^2 + uy^2 + 1e-10);

Nx=ux/normDu;

Ny=uy/normDu;

diracU=Dirac(u,epsilon);

K=curvature_central(Nx,Ny);

weightedLengthTerm=lambdadiracU(vxNx + vyNy + gK);

penalizingTerm=mu(4del2(u)-K);

weightedAreaTerm=alfdiracUg;

u=u+delt(weightedLengthTerm + weightedAreaTerm + penalizingTerm); % update the level set function

end

% the following functions are called by the main function EVOLUTION

function f = Dirac(x, sigma) %水平集狄拉克计算

f=(1/2/sigma)(1+cos(pix/sigma));

b = (x<=sigma) & (x>=-sigma);

f = fb;

function K = curvature_central(nx,ny); %曲率中心

[nxx,junk]=gradient(nx);

[junk,nyy]=gradient(ny);

K=nxx+nyy;

function g = NeumannBoundCond(f)

% Make a function satisfy Neumann boundary condition

[nrow,ncol] = size(f);

g = f;

g([1 nrow],[1 ncol]) = g([3 nrow-2],[3 ncol-2]);

g([1 nrow],2:end-1) = g([3 nrow-2],2:end-1);

g(2:end-1,[1 ncol]) = g(2:end-1,[3 ncol-2]);

因为你base1是level2,level1虚继承 有共同继承先调用(属性要高一个级别)根据C++语法 先调用虚继承父类 在从左往右调用继承父类 在调用内嵌对象构造函数最后调用派生类的构造函数。

这种题很无聊,浪费时间,多换点时间编写程序才硬道理。

开始两个链表都是单链表,而且是递增的,要想让它们合并成一条链表并且递减,那么就得想好对策,因为链表是从头往尾走,从小往大走,所以每次都比较两链表的大小,选出最小的往新链表的头部插进去,并且被选中的链表向后走一个元素,那么就能保证每次插入新链表的元素都不小于之前插入的元素,这样就能得到递减的新链表。if-else语句就是来选较小元素插入新链表,插入的方法与将一个元素插入链表的方法是一样的。第一个while语句做完之后一定会有一个链表的元素先为空,后面两个while语句就是用来判断最后还有哪个链表中有元素,有的话就直接一个一个插入新链表即可。有关链表的程序,掌握方法后就能触类旁通。

关于level的意思如下:

n水平;级别;层次;程度v对准;使平坦;使平整;夷平(建筑物或树林)adj平的;平坦的;等高的;地位相同的adv准确;平坦地;和…成水平;势均力敌地

She said a close above the 900 level Monday, with a high degree of participation, would set the scene for a push higher她接着说,周一指数接近超过900点,并伴有很高的参与度将促使股票攀升。

We trade the sort of security and safety of a certain level of contentment for these transcendent moments我们用那些安全保险为我们带来的一定程度上的满意去交换那些特殊时光。

Researchers are now able to understand human behaviour at the population level rather than the individual level研究人员现在能够从人口水平而不是个人层面上理解人类行为。

If my understanding of the volleyball team to help the UnitedStates to improve their level, it would be a very wonderful thing如果我对排球的理解能够帮助美国队提高自己的水平,那将是非常美妙的事情。

This war is also designed to increase the power of communism tothe level that it equalled that of united Christendom这场战争还被设计来增加共产主义的势力到一个它与联合的基督教世界并驾齐驱的水平。

The Champions League, FA Cup, leagueit's not easyto keep this level if you do not have the money that maybe other teams have冠军杯、足总杯、联赛,如果你没有像其他球队足够的资金话,你根本保持不了竞技水平。

We are Alevel politics students who have been studying civil liberties as part of the curriculum for the last two years我们是学过高级政治课程的学生,过去两年来,我们一直有学习“公民自由”,那是课程的一部分。

Although they pickedit up fairly quickly, I could see thatan uptodate, entry level book would have been a help尽管他们相当快就可以上手使用了,可我还是认为最新的入门书籍会有所帮助。

However, the State Council did not give any details of the level to which it would be increased不过,该部门并没有提及具体的提升幅度。

Administrators can limit how much isolated storage an application or a user has available, based on an appropriate trust level管理员可以根据适当的信任级别限制应用程序或用户可以使用多少独立存储。

#include <iostream>

#include <ctypeh>

#include <fstream>

#include <stringh>

#include <malloch>

using namespace std;

ifstream fp("sourcetxt",ios::in);

char cbuffer;

char key[13]={"if","else","for","while","do","return","break","continue","int","void"

,"main","const","printf"}; //关键字

char border[7]={ "," , ";" , "{" , "}" , "(" , ")" ,"//"}; //分界符

char arithmetic[6]={"+" , "-" , "" , "/" , "++" , "--"}; //运算符

char relation[7]={"<" , "<=" , "=" , ">" , ">=" , "==" ,"!="}; //关系运算符

char lableconst[80]; //标识符

int constnum=40;

int lableconstnum=0;

int linenum=1; //统计常数和标识符数量

int search(char searchchar[],int wordtype)

{

int i=0,t=0;

switch (wordtype)

{

case 1:

{ for (i=0;i<=12;i++) //关键字

{

if (strcmp(key[i],searchchar)==0)

return(i+1);

}

return(0);}

case 2:

{

for (i=0;i<=6;i++) //分界符

{

if (strcmp(border[i],searchchar)==0)

return(i+1);

}

return(0);

}

case 3:

{

for (i=0;i<=5;i++) //运算符

{

if (strcmp(arithmetic[i],searchchar)==0)

return(i+1);

}

return(0);

}

case 4:

{

for (i=0;i<=6;i++) //关系运算符

{

if (strcmp(relation[i],searchchar)==0)

return(i+1);

}

return(0);

}

case 5:

{

for (t=40;t<=constnum;t++) //常数

{

if (strcmp(searchchar,lableconst[t])==0)//判断该常数是否已出现过

return(t+1);

}

lableconst[t-1]=(char )malloc(sizeof(searchchar));//为新的元素分配内存空间

strcpy(lableconst[t-1],searchchar);//为数组赋值lableconst指针数组名

constnum++; //常数个数自加

return(t);

}

case 6:

{

for (i=0;i<=lableconstnum;i++)

{

if (strcmp(searchchar,lableconst[i])==0) //判断标识符是否已出现过

return(i+1);

}

lableconst[i-1]=(char )malloc(sizeof(searchchar));

strcpy(lableconst[i-1],searchchar);

lableconstnum++; //标识符个数自加

return(i);

}

default:cout<<"错误!";

}

}

char alphaprocess(char buffer) //字符处理过程

{

int atype;

int i=-1;

char alphatp[20];

while ((isalpha(buffer))||(isdigit(buffer)))

//这两个函数分别是判字符和判数字函数位于ctypeh中

{

alphatp[++i]=buffer;

fpget(buffer);

}

alphatp[i+1]='\0';//在末尾添加字符串结束标志

if (atype=search(alphatp,1))

cout<<"linenum: "<<linenum<<" String= "<<alphatp<<"\t\t\t"<<"关键字"<<endl;

else

{

atype=search(alphatp,6); //标识符

cout<<"linenum: "<<linenum<<" String= "<<alphatp<<"\t\t\t"<<"标识符"<<endl;

}

return(buffer);

}

char digitprocess(char buffer) //数字处理过程

{

int i=-1;

char digittp[20];

int dtype;

while ((isdigit(buffer)))

{

digittp[++i]=buffer;

fpget(buffer);

}

digittp[i+1]='\0';

dtype=search(digittp,5);

cout<<"linenum: "<<linenum<<" String= "<<digittp<<"\t\t\t"<<"数据"<<endl;

return(buffer);

}

char otherprocess(char buffer) //分界符、运算符、逻辑运算符、等

{

int i=-1;

char othertp[20];

int otype,otypetp;

othertp[0]=buffer;

othertp[1]='\0';

if (otype=search(othertp,3))

{

fpget(buffer);

othertp[1]=buffer;

othertp[2]='\0';

if (otypetp=search(othertp,3)) //判断该运算符是否是

//由连续的两个字符组成的

{

cout<<"linenum: "<<linenum<<" String= "<<othertp<<"\t\t\t"<<"运算符"<<endl;

fpget(buffer);

goto out;

}

else //单字符逻辑运算符

{

othertp[1]='\0';

cout<<"linenum: "<<linenum<<" String= "<<othertp<<"\t\t\t"<<"逻辑运算符"<<endl;

goto out;

}

}

if (otype=search(othertp,4)) //关系运算符

{

fpget(buffer);

othertp[1]=buffer;

othertp[2]='\0';

if (otypetp=search(othertp,4)) //判断该关系运算符是否是

//由连续的两个字符组成的

{

cout<<"linenum: "<<linenum<<" String= "<<othertp<<"\t\t\t"<<"关系运算符"<<endl;

fpget(buffer);

goto out;

}

else //单字符逻辑运算符

{

othertp[1]='\0';

cout<<"linenum: "<<linenum<<" String= "<<othertp<<"\t\t\t"<<"逻辑运算"<<endl;

goto out;

}

}

if (buffer=='!') //"=="的判断

{

fpget(buffer);

if (buffer=='=')

//cout<<"!= (2,2)\n";

fpget(buffer);

goto out;

}

else

{

if (otype=search(othertp,2)) //分界符

{

cout<<"linenum: "<<linenum<<" String= "<<othertp<<"\t\t\t"<<"分界符"<<endl;

fpget(buffer);

goto out;

}

}

if ((buffer!='\n')&&(buffer!=' '))

cout<<"错误!,字符非法"<<"\t\t\t"<<buffer<<endl;

fpget(buffer);

out: return(buffer);

}

void main()

{

int i;

for (i=0;i<=50;i++)

{

lableconst[i]=" ";//用于保存标识符

}

if (!fp)

cout<<"文件打开错误!!"<<endl;

else

{

fpget (cbuffer);

while (!fpeof())

{

if(cbuffer=='\n')

{

linenum++;

fpget(cbuffer);

}

else if (isalpha(cbuffer))

{

cbuffer=alphaprocess(cbuffer);

}

else if (isdigit(cbuffer))

{

cbuffer=digitprocess(cbuffer);

}

else

cbuffer=otherprocess(cbuffer);

}

}

cout<<"标识符个数是:"<<lableconstnum<<"分别是"<<endl;

i=0;

while(i<lableconstnum)

{

cout<<lableconst[i++]<<" ";

}

cout<<endl;

cout<<"完成\n";

getchar();

}

以上就是关于matlab 程序解释 急需全部的内容,包括:matlab 程序解释 急需、c++ 运行结果不懂。。。。为什么先level2后level1、下面的C语言程序,合并单链表La和Lb。if语句往下几行,具体是什么意思呢等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/10079478.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-05
下一篇2023-05-05

发表评论

登录后才能评论

评论列表(0条)

    保存