当前位置:网站首页>Matlab Error (Matrix dimensions must agree)
Matlab Error (Matrix dimensions must agree)
2022-07-06 19:37:00 【全栈程序员站长】
大家好,又见面了,我是全栈君
xOld =input(‘Enter initial guess: ‘);
errortmp =2;
counter =0;
while (errortmp>10^-10)
xNew =xOld – Jf3(xOld)\f3(xOld)
counter=counter+1
error=norm(xNew-xOld,inf)+4*eps*norm(xNew,inf)
if(error>=errortmp)
error(‘shit!’);
else
errortmp=error;
end
xOld = xNew;
pause
end
function J=Jf3(x)
J=[0 0 1 1;
x(3) x(4) x(1) x(2);
2*x(3)*x(1) 2*x(4)*(x(2)) x(1)^2 x(2)^2;
3*x(3)*x(1)^2 3*x(4)*(x(2))^2 x(1)^3 x(2)^3];
function y=f3(x)
y=[x(3)+x(4)-2;
x(3)*x(1) + x(4)*x(2);
x(3)*x(1)^2 + x(4)*x(2)^2 – (2/3);
x(3)*x(1)^3 + x(4)*x(2)^3];
end
//当用户输入数值时。一定要输入一个matrix,不能仅仅输入一个数值,否则会显示:Matrix dimensions must agree
输入 1; //这时我们输入的仅仅是一个数字
输入 1 2 2 3; //这时我们输入的并非matrix
输入 [1 2 3 4 ] //这时我们输入的也不是matrix
输入 [1;2;3;4] //正确
这是由至,输入值表格和表格处理功能是不一样的,因此错误代码将被显示
版权声明:本文博主原创文章。博客,未经同意不得转载。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/116791.html原文链接:https://javaforall.cn
边栏推荐
- How-PIL-to-Tensor
- Redis入門完整教程:問題定比特與優化
- 上个厕所的功夫,就把定时任务的三种调度策略说得明明白白
- Convert widerperson dataset to Yolo format
- 【Socket】①Socket技术概述
- 2022 spring recruitment begins, and a collection of 10000 word interview questions will help you
- mos管實現主副電源自動切換電路,並且“零”壓降,靜態電流20uA
- Es6中Promise的使用
- Detailed explanation of 19 dimensional integrated navigation module sinsgps in psins (time synchronization part)
- 代码调试core-踩内存
猜你喜欢
MySQL - common functions - string functions
What management points should be paid attention to when implementing MES management system
Redis入门完整教程:复制拓扑
tensorboard的使用
[socket] ① overview of socket technology
Development of wireless communication technology, cv5200 long-distance WiFi module, UAV WiFi image transmission application
leetcode-02(链表题)
Redis入门完整教程:AOF持久化
Es6中Promise的使用
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
随机推荐
Number theory --- fast power, fast power inverse element
Es6中Promise的使用
Nuggets quantification: obtain data through the history method, and use the same proportional compound weight factor as Sina Finance and snowball. Different from flush
What are the applications and benefits of MES management system
QT common Concepts-1
INS/GPS组合导航类型简介
杰理之电话本获取【篇】
【2022国赛模拟】多边形——计算几何、二分答案、倍增
Left value, right value
Le tube MOS réalise le circuit de commutation automatique de l'alimentation principale et de l'alimentation auxiliaire, et la chute de tension "zéro", courant statique 20ua
Classify the features of pictures with full connection +softmax
杰理之关于 DAC 输出功率问题【篇】
Read fast RCNN in one article
Es6中Promise的使用
Summary of research status of inertial navigation calibration at home and abroad (abridged version)
换个姿势做运维!GOPS 2022 · 深圳站精彩内容抢先看!
知识图谱构建全流程
Planning and design of double click hot standby layer 2 network based on ENSP firewall
巴比特 | 元宇宙每日必读:IP授权是NFT的破圈之路吗?它的难点在哪里?Holder该如何选择合作平台?...
MySQL - common functions - string functions