当前位置:网站首页>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
边栏推荐
- 上个厕所的功夫,就把定时任务的三种调度策略说得明明白白
- Shell 编程基础
- What management points should be paid attention to when implementing MES management system
- Change your posture to do operation and maintenance! GOPs 2022 Shenzhen station highlights first!
- Install redis from zero
- Error in fasterxml tostringserializerbase
- Redis入门完整教程:客户端案例分析
- QT常见概念-1
- 2022 spring recruitment begins, and a collection of 10000 word interview questions will help you
- 知识图谱构建全流程
猜你喜欢

leetcode

从 1.5 开始搭建一个微服务框架——日志追踪 traceId

Summary of basic debugging steps of S120 driver

从零安装Redis

How to design interface test cases? Teach you a few tips to draft easily

【2022国赛模拟】多边形——计算几何、二分答案、倍增

左程云 递归+动态规划

A complete tutorial for getting started with redis: AOF persistence

Remember the problem analysis of oom caused by a Jap query

Unity使用MaskableGraphic画一条带箭头的线
随机推荐
ERROR: Could not find a version that satisfies the requirement xxxxx (from versions: none)解决办法
Remember the problem analysis of oom caused by a Jap query
input_delay
Django数据库(SQlite)基本入门使用教程
Left path cloud recursion + dynamic planning
Wireshark installation
Analysis of USB network card sending and receiving data
Redis入门完整教程:问题定位与优化
C language exercises_ one
Cryptography series: detailed explanation of online certificate status protocol OCSP
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
leetcode
你知道电子招标最突出的5大好处有哪些吗?
LeetCode 77:组合
Install redis from zero
Number theory --- fast power, fast power inverse element
Five reasons for clothing enterprises to deploy MES management system
Error: could not find a version that satisfies the requirement xxxxx (from versions: none) solutions
Redis入门完整教程:客户端常见异常
How to write test cases for test coupons?