matlab怎样求矩阵已知特征值怎么求矩阵?

MATLAB 矩阵的特征值与特征向量
%矩阵的特征值与特征向量%E=eig(A):求矩阵A的全部特征值,构成向量E%[X,D]=eig(A):求矩阵A的全部特征值,构成对角阵D,并产生矩阵X,X各列是相应的特征向量。
运用1:A=[1,1,0;1,0,5;1,10,2]
[X,D]=eig(A)%求特征值
A*X(:,1)
D(1)*X(:,1)
运用2:R=[-1,2,0;2,-4,1;1,1,6];
S=[1,2;2,3];
A=[R,zeros(3,2);zeros(2,3),S];
[X1,d1]=eig(R)
[X2,d2]=eig(S)
[X3,d3]=eig(A)
%特征值的几何意义%eigshow函数
代码如下:x=[0,0.5,0.5,3,5.5,5.5,6,6,3,0;0,0,6,0,6,0,0,8,1,8];
A=[1,0.5;0,1];
y=A*x;
subplot(2,2,1);
fill(x(1,:),x(2,:),'r')
subplot(2,2,2);
fill(y(1,:),y(2,:),'r')
怎么用Matlab求矩阵的特征值和特征向量
2021-06-22 好评回答在进行数据分析的时候我们有时候需要求我们建立的矩阵的特征值,尤其是最大特征值以及其对应的特征向量。小编还记得当初学习矩阵的时候笔算特征值和特征向量的痛苦,随着矩阵阶数的扩大,运算量比较大,但是如果使用软件Matlab来计算可以节省很多时间。所以今天小编和大家一起使用Matlab来计算矩阵的最大特征值和相应的特征向量启动Matlab ,在命令窗口输入要处理的矩阵AA=[1,4,2,4;1/4,1,1/2,1;1/2,2,1,1/2;1/4,1,2,1]输入完成后回车软件会按行列的形式显示矩阵顺便我们可以检查一下矩阵是否输入错误接着输入[x,y]=eig(A) 回车我们就可以看到矩阵的所有特征值和特征向量了特征值是对角矩阵y 矩阵x的每一列对应一个y中相应列的特征值此处注意括号必须是在英文输入法下输入 如果显示红色表示有问题需要重新输入虽然我们已经计算出了矩阵的特征值和特征向量 但是如果我们只是计算这一个的话 我们完全可以观察得到最大的特征值接着输入eigenvalue=diag(y)。lamda=eigenvalue(1)lamda表示最大的特征值 这里lamda=4.2498求出矩阵最大特征值之后我们虽然可以一眼看到特征向量 但是不方便以后我们大量的处理矩阵此时再输入y_lamda = x(, 1) 即最大特征值对应的特征向量上面的过程只是适合我们进行一次两次这样的计算 如果遇到需要较多的矩阵的时候或者这样的过程只是某些计算中的几步需求的时候我们就需要把前面的计算合在一起进行计算 比如小编这样 同样我们也可以把这段代码放在需要的算法程序中除了直接输入变量结果来查看的方法外 我们还可以直接在workspace中查看变量运算结果 中的lamda和y_lamda的结果值

',getTip:function(t,e){return t.renderTip(e.getAttribute(t.triangularSign),e.getAttribute("jubao"))},getILeft:function(t,e){return t.left+e.offsetWidth/2-e.tip.offsetWidth/2},getSHtml:function(t,e,n){return t.tpl.replace(/\{\{#href\}\}/g,e).replace(/\{\{#jubao\}\}/g,n)}},baobiao:{triangularSign:"data-baobiao",tpl:'{{#baobiao_text}}',getTip:function(t,e){return t.renderTip(e.getAttribute(t.triangularSign))},getILeft:function(t,e){return t.left-21},getSHtml:function(t,e,n){return t.tpl.replace(/\{\{#baobiao_text\}\}/g,e)}}};function l(t){return this.type=t.type
"defaultTip",this.objTip=u[this.type],this.containerId="c-tips-container",this.advertContainerClass=t.adSelector,this.triangularSign=this.objTip.triangularSign,this.delaySeconds=200,this.adventContainer="",this.triangulars=[],this.motherContainer=a("div"),this.oTipContainer=i(this.containerId),this.tip="",this.tpl=this.objTip.tpl,this.init()}l.prototype={constructor:l,arrInit:function(){for(var t=0;t0}});else{var t=window.document;n.prototype.THROTTLE_TIMEOUT=100,n.prototype.POLL_INTERVAL=null,n.prototype.USE_MUTATION_OBSERVER=!0,n.prototype.observe=function(t){if(!this._observationTargets.some((function(e){return e.element==t}))){if(!t
1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},n.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter((function(e){return e.element!=t})),this._observationTargets.length
(this._unmonitorIntersections(),this._unregisterInstance())},n.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},n.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},n.prototype._initThresholds=function(t){var e=t
[0];return Array.isArray(e)
(e=[e]),e.sort().filter((function(t,e,n){if("number"!=typeof t
isNaN(t)
t1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]}))},n.prototype._parseRootMargin=function(t){var e=(t
"0px").split(/\s+/).map((function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}}));return e[1]=e[1]
e[0],e[2]=e[2]
e[0],e[3]=e[3]
e[1],e},n.prototype._monitorIntersections=function(){this._monitoringIntersections
(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(r(window,"resize",this._checkForIntersections,!0),r(t,"scroll",this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in window&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},n.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,i(window,"resize",this._checkForIntersections,!0),i(t,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},n.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),n=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach((function(r){var i=r.element,a=o(i),c=this._rootContainsTarget(i),s=r.entry,u=t&&c&&this._computeTargetAndRootIntersection(i,n),l=r.entry=new e({time:window.performance&&performance.now&&performance.now(),target:i,boundingClientRect:a,rootBounds:n,intersectionRect:u});s?t&&c?this._hasCrossedThreshold(s,l)&&this._queuedEntries.push(l):s&&s.isIntersecting&&this._queuedEntries.push(l):this._queuedEntries.push(l)}),this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},n.prototype._computeTargetAndRootIntersection=function(e,n){if("none"!=window.getComputedStyle(e).display){for(var r,i,a,s,u,l,f,h,p=o(e),d=c(e),v=!1;!v;){var g=null,m=1==d.nodeType?window.getComputedStyle(d):{};if("none"==m.display)return;if(d==this.root
d==t?(v=!0,g=n):d!=t.body&&d!=t.documentElement&&"visible"!=m.overflow&&(g=o(d)),g&&(r=g,i=p,a=void 0,s=void 0,u=void 0,l=void 0,f=void 0,h=void 0,a=Math.max(r.top,i.top),s=Math.min(r.bottom,i.bottom),u=Math.max(r.left,i.left),l=Math.min(r.right,i.right),h=s-a,!(p=(f=l-u)>=0&&h>=0&&{top:a,bottom:s,left:u,right:l,width:f,height:h})))break;d=c(d)}return p}},n.prototype._getRootRect=function(){var e;if(this.root)e=o(this.root);else{var n=t.documentElement,r=t.body;e={top:0,left:0,right:n.clientWidth
r.clientWidth,width:n.clientWidth
r.clientWidth,bottom:n.clientHeight
r.clientHeight,height:n.clientHeight
r.clientHeight}}return this._expandRectByRootMargin(e)},n.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map((function(e,n){return"px"==e.unit?e.value:e.value*(n%2?t.width:t.height)/100})),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},n.prototype._hasCrossedThreshold=function(t,e){var n=t&&t.isIntersecting?t.intersectionRatio
0:-1,r=e.isIntersecting?e.intersectionRatio
0:-1;if(n!==r)for(var i=0;i0&&function(t,e,n,r){var i=document.getElementsByClassName(t);if(i.length>0)for(var o=0;o展开全部
a =8
1
63
5
74
9
2>> eig(a)ans =15.00004.8990-4.8990
本回答被网友采纳
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
为你推荐:
下载百度知道APP,抢鲜体验使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。扫描二维码下载
×个人、企业类侵权投诉
违法有害信息,请在下方选择后提交
类别色情低俗
涉嫌违法犯罪
时政信息不实
垃圾广告
低质灌水
我们会通过消息、邮箱等方式尽快将举报结果通知您。说明
做任务开宝箱累计完成0
个任务
10任务
50任务
100任务
200任务
任务列表加载中...

我要回帖

更多关于 已知特征值怎么求矩阵 的文章