当前位置:网站首页>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
边栏推荐
猜你喜欢

Analysis of USB network card sending and receiving data

Nuggets quantification: obtain data through the history method, and use the same proportional compound weight factor as Sina Finance and snowball. Different from flush

Es6中Promise的使用

Cryptography series: detailed explanation of online certificate status protocol OCSP

Error: could not find a version that satisfies the requirement xxxxx (from versions: none) solutions
Django数据库(SQlite)基本入门使用教程

巴比特 | 元宇宙每日必读:IP授权是NFT的破圈之路吗?它的难点在哪里?Holder该如何选择合作平台?...

Have fun | latest progress of "spacecraft program" activities

Software testing -- common assertions of JMeter interface testing

Remember the problem analysis of oom caused by a Jap query
随机推荐
Classify the features of pictures with full connection +softmax
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
PSINS中19维组合导航模块sinsgps详解(初始赋值部分)
What are the applications and benefits of MES management system
Redis入门完整教程:客户端常见异常
input_delay
Examples of how to use dates in Oracle
centerX: 用中国特色社会主义的方式打开centernet
Form validation of uniapp
How to find file accessed / created just feed minutes ago
2022 spring recruitment begins, and a collection of 10000 word interview questions will help you
Redis入门完整教程:复制原理
从 1.5 开始搭建一个微服务框架——日志追踪 traceId
uniapp适配问题
杰理之RTC 时钟开发【篇】
Convert widerperson dataset to Yolo format
Code debugging core step memory
巴比特 | 元宇宙每日必读:IP授权是NFT的破圈之路吗?它的难点在哪里?Holder该如何选择合作平台?...
Use of promise in ES6
Data analysis from the perspective of control theory