




已阅读5页,还剩6页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1. 在44的棋盘上安置4个皇后,要求任意两个皇后不在同一行、不在同一列、不在同一对角线上,输出所有的方案。for i1=1:4 %i1.。表示皇后的位置 for i2=1:4 for i3=1:4 for i4=1:4 hh=zeros(4,4);%用于模拟棋盘 hh(1,i1)=1; % 1表示此处有皇后 由于分列,所以不再同一列 hh(2,i2)=1; hh(3,i3)=1; hh(4,i4)=1; if i1=i2 | i1=i3 | i1=i4 | i2=i3 | i2=i4 | i3=i4 % 判断是否在同一行 continue; end if abs(i1-i2)=1 | abs(i1-i3)=2 | abs(i1-i4)=3 | abs(i2-i3)=1 | abs(i2-i4)=2 . | abs(i3-i4)=1 % 判断是否在一条对角线上 continue; end disp(hh);%打印棋盘,1为皇后 end end endend2. 问题描述:有形如下图所示的数塔,从顶部出发,在每一结点可以选择向左走或是向右走,一直走到底层,要求找出一条路径,使路径上的数值的和最接近零。n=input(输入数塔的层数n(正整数n=20) );st=zeros(n);for i1=1:n for j1=1:i1 fprintf(输入第%d行第%d个数据(且数字的绝对值不超过1000000) ,i1,j1); st(i1,j1)=input( ); endendsz=inf;ls=zeros(1,n(1)-1);lj=zeros(1,n(1)-1);for i1=0:2n-1 ss=st(1,1); for j1=1:n(1)-1 ls(j1)=mod(i1,2); i1=floor(i1/2); end k=1; for j1=1:n(1)-1 k=k+ls(j1); ss=ss+st(j1+1,k); end if ss=1 & a=4 fprintf(computer take %d awaynthere is %d leftn,5-a,21-5*i); endenddisp(computer win !);麦克斯韦方程组的积分形式:(in matter)这是1873年前后,麦克斯韦提出的表述电磁场普遍规律的四个方程。其中:(1)描述了电场的性质。在一般情况下,电场可以是库仑电场也可以是变化磁场激发的感应电场,而感应电场是涡旋场,它的电位移线是闭合的,对封闭曲面的通量无贡献。(2)描述了磁场的性质。磁场可以由传导电流激发,也可以由变化电场的位移电流所激发,它们的磁场都是涡旋场,磁感应线都是闭合线,对封闭曲面的通量无贡献。(3)描述了变化的磁场激发电场的规律。(4)描述了变化的电场激发磁场的规律。变化场与稳恒场的关系:当时,方程组就还原为静电场和稳恒磁场的方程:(in matter)在没有场源的自由空间,即q=0, I=0,方程组就成为如下形式:(in matter)麦克斯韦方程组的积分形式反映了空间某区域的电磁场量(D、E、B、H)和场源(电荷q、电流I)之间的关系。4.2微分形式麦克斯韦方程组微分形式:在电磁场的实际应用中,经常要知道空间逐点的电磁场量和电荷、电流之间的关系。从数学形式上,就是将麦克斯韦方程组的积分形式化为微分形式。利用矢量分析方法,可得:(in matter)注意:(1)在不同的惯性参照系中,麦克斯韦方程有同样的形式。(2) 应用麦克斯韦方程组解决实际问题,还要考虑介质对电磁场的影响。例如在各向同性介质中,电磁场量与介质特性量有下列关系:在非均匀介质中,还要考虑电磁场量在界面上的边值关系。在利用t=0时场量的初值条件,原则上可以求出任一时刻空间任一点的电磁场,即E(x,y,z,t)和B(x,y,z,t)。麦克斯韦方程组微分形式(高斯单位制)还是试下通俗讲吧:电场分两种,一种是有源,也就是沿着电场线某一段总有终点,如电子产生的电场;一种无源(或称为有旋?),换而言之就是无论沿着线往哪边走都没有尽头,如均匀变化的均匀磁场,电场线是一个个圆,无始无终。Maxwell方程组其一:有源电场由且仅由电荷产生Maxwell方程组其二:无源电场由且仅由变化的磁场产生同样磁场也分这么两种,类比就好Maxwell方程组其三:没有有源磁场,哈哈,意思就是没有磁荷了(与电荷相对应)Maxwell方程组其四:无源磁场由且仅由电流和变化的电场产生Maxwell方程组也诠释了具体的产生方式,但你要通俗的化也没必要说了。其实对电场磁场的描述几乎一模一样,差就差在有电荷却没磁荷这一点,导致了方程一跟方程三的不同。而二四呢,因为电荷可以形成电流,所以方程四多了一个由电流产生。如果有磁荷的话,方程二也会改成由磁流跟变化的磁场产生,方程三也为改成由磁荷产生。如此两者形式便一模一样了。弦论里预言的磁单极子便有此般意味在里面。function features, valid_points = extractFeatures(I, points, varargin)%extractFeatures Extract interest point descriptors% extractFeatures extracts feature vectors, also known as descriptors,% from a binary or intensity image. Descriptors are derived from pixels% surrounding an interest point. They are needed to describe and match % features specified by a single point location.% FEATURES, VALID_POINTS = extractFeatures(I, POINTS) returns FEATURES,% an M-by-N matrix of M feature vectors, also known as descriptors. Each% descriptor is of length N. The function also returns M number of % VALID_POINTS corresponding to each descriptor. The method used for % descriptor extraction depends on class of POINTS:% Class of POINTS Descriptor extraction method% - -% - SURFPoints object - Speeded-Up Robust Features (SURF)% - MSERRegions object - Speeded-Up Robust Features (SURF)% - M-by-2 matrix of x y - Simple square neighborhood around x y% coordinates point location% FEATURES, VALID_POINTS = extractFeatures(I, POINTS, PARAM1, VAL1,% PARAM2, VAL2) can be used to specify additional parameters:% Method - One of the strings: Block, SURF or Auto. % Method Feature vector (descriptor)% - -% Block Simple square neighborhood% SURF Speeded-Up Robust Features (SURF)% Auto Selects the method based on the class of % input points: SURF when POINTS is a SURFPoints % object or MSERRegions object and Block when POINTS% is an M-by-2 matrix of x y coordinates% Default: Auto% BlockSize - An odd integer scalar defining the local square % neighborhood (BlockSize-by-BlockSize) centered at% each interest point. This option is only% applicable to Block method.% Default: 11% SURFSize - Integer scalar set to 64 or 128. Length of the SURF% feature vector (descriptor). This option is only% applicable to SURF method.% Default: 64% Notes% -% - When Block method is used, the function extracts only the % neighborhoods fully contained within the image boundary, therefore % VALID_POINTS may contain fewer points than input POINTS.% - When SURF is used to extract descriptors, the Orientation property% of returned VALID_POINTS SURFPoints object is set to the orientation % of extracted features, in radians. This is useful for visualizing % the SURF descriptor orientation.% - When MSERRegions object is used with SURF, the Centroid property of % the object is used to extract SURF descriptors. The Axes property is % used to select the scale of the SURF descriptors such that the circle% representing the feature has an area proportional to MSER ellipse % area. The Orientation property is not used.% - You can increase SURFSize from the default 64 to 128 to increase% descriptor matching accuracy at the expense of matching speed.% Class Support% -% The input image I can be logical, uint8, uint16, int16, single, or % double, and it must be real and nonsparse. POINTS can be int16, uint16,% int32, uint32, single or double, and it must be real and nonsparse.% Example 1% -% % Extract corner features from an image.% I = imread(pout.tif);% % hcornerdet = vision.CornerDetector;% points = step(hcornerdet, I);% % features, valid_points = extractFeatures(I, points);% % figure; imshow(I); hold on % % Plot interest points% plot(points(:,1), points(:,2), b.)% % Overlay valid interest points% plot(valid_points(:,1), valid_points(:,2), y.)% Example 2% -% % Extract SURF features% I = imread(cameraman.tif);% points = detectSURFFeatures(I);% features, valid_points = extractFeatures(I, points);% % Visualize 10 strongest SURF features, including their scale, and % % orientation which was determined during the descriptor extraction% % process.% figure; imshow(I); hold on;% plot(valid_points.selectStrongest(10),showOrientation,true);% Example 3% -% % Extract MSER features% I = imread(cameraman.tif);% regions = detectMSERFeatures(I);% % Use MSER with SURF feature descriptor% features, valid_points = extractFeatures(I, regions);% % Visualize SURF features corresponding to the MSER ellipse centers % % along with scale and orientation.% figure; imshow(I); hold on;% plot(valid_points,showOrientation,true);% % See also vision.CornerDetector, detectSURFFeatures, detectMSERFeatures,% matchFeatures.% Copyright 2010 The MathWorks, Inc.% $Revision: 1.1.6.8 $ $Date: 2011/09/03 23:36:02 $% Parse and check inputsisXY = cvstGetCoordsChoice(fcnExtractFeatures);method, blockSize, SURFSize = parseInputs(I, points, isXY, varargin:);% Extract features from image Iif strcmp(method, Block) if isa(points,SURFPoints) points = points.Location; elseif isa(points,MSERRegions) points = points.Centroid; elseif isXY % Convert points from R/C, 0-based coordinates to X/Y, 1-based % coordinates. points = fliplr(points + 1); end features, valid_points = cvalgExtractFeatures(I, points, blockSize); if isXY features = features; valid_points = flipud(valid_points - 1); endelse % SURF if isa(points,MSERRegions) centroid = points.Centroid; majorAxes = points.Axes(:,1); minorAxes = points.Axes(:,2); scale = 1/4*sqrt(majorAxes/2).*(minorAxes/2); % Saturate scale to 1.6 as required by SURFPoints scale(scale 1.6) = 1.6; points = SURFPoints(centroid,Scale,scale); end Iu8,ptsStruct = parseSURFInputs(I,points); % we are using cvExtractSurf with point inputs, therefore only % the extended parameter matters; the other can remain unset params.extended = SURFSize = 128; vPts, features = ocvExtractSurf(Iu8, ptsStruct, params); valid_points = SURFPoints(vPts.Location, vPts); end%=% Parse and check inputs%=function method, blockSize,SURFSize = . parseInputs(I, points, isXY, varargin)% Check imagecheckImage(I);% Setup parserparser = inputParser;parser.CaseSensitive = true;parser.FunctionName = mfilename;parser.addParamValue(Method, Auto, checkMethod);parser.addParamValue(BlockSize, 11, checkBlockSize);parser.addParamValue(SURFSize, 64, checkSURFSize);% Parse inputparser.parse(varargin:);% Assign outputsr = parser.Results;method blockSize SURFSize = deal(r.Method, r.BlockSize, r.SURFSize);% Handle Auto choiceif strcmp(method,Auto) if isa(points,SURFPoints) | isa(points,MSERRegions) method = SURF; else method = Block; endend% Check pointsif isa(points, SURFPoints) & isa(points, MSERRegions) checkPoints(points, method, isXY);end;%=% Parse SURF inputs%=function Iu8, ptsStruct = parseSURFInputs(I, points)if isa(I,uint8) Iu8 = I;else Iu8 = im2uint8(I);end% If needed, convert raw X,Y coordinates to SURFPointsif isa(points, SURFPoints) ptsObj = SURFPoints(points);else ptsObj = points;end% convert SURFPoints object back to structure required by% the ocvExtractSurf built-in functionptsStruct.Location = ptsObj.Location;ptsStruct.Scale = ptsObj.Scale;ptsStruct.Metric = ptsObj.Metric;ptsStruct.SignOfLaplacian = ptsObj.SignOfLapl
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年细胞治疗产品临床试验法规解读与审批流程报告
- 海上风能资源评估报告2025年深远海风电发展规划海上风电场经济效益分析
- 茶与咖啡的跨界融合:2025年市场发展趋势与品牌竞争力研究报告
- 城市自来水厂升级改造2025年环境友好型技术应用报告
- 2025年智能仓储货架制造项目智能控制系统研发报告
- 物联网设备安全漏洞防护策略深度剖析:2025年技术标准解读报告001
- 2025年医院信息化建设电子病历系统优化策略研究报告
- 2025年医院电子病历系统优化在医院信息化建设中的数据安全防护机制研究报告
- 2025年城市地下综合管廊建设专项债券资金申请财务分析报告
- 2025年医药行业CRO研发外包模式下的研发项目管理培训与咨询报告
- 外墙吊篮安全专项施工方案
- 思维可视化工具在英语教学中的应用探究 论文
- GMP清洁验证课件
- 养老护理员四级理论试题及答案
- 脊柱内镜技术
- 采购询价单模板
- 心理测量课件-常见量表介绍与应用
- 隆鼻术后护理查房
- 关于进境食用水生动物指定监管场地名单
- 2023年主任医师(正高)-中医内科学(正高)考试历年真题集锦附答案
- 农村分家协议书4篇
评论
0/150
提交评论