当前位置:网站首页>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
边栏推荐
猜你喜欢
商城商品的知识图谱构建
“零售为王”下的家电产业:什么是行业共识?
Classify the features of pictures with full connection +softmax
Don't you know the relationship between JSP and servlet?
Redis getting started complete tutorial: client management
OC, OD, push-pull explanation of hardware
Use of promise in ES6
LeetCode 77:组合
尚硅谷JVM-第一章 类加载子系统
掘金量化:通过history方法获取数据,和新浪财经,雪球同用等比复权因子。不同于同花顺
随机推荐
Cloud Mail . NET Edition
PSINS中19维组合导航模块sinsgps详解(初始赋值部分)
Oracle connection pool is not used for a long time, and the connection fails
A complete tutorial for getting started with redis: AOF persistence
Wireshark installation
惯导标定国内外研究现状小结(删减版)
Kysl Haikang camera 8247 H9 ISAPI test
QT常见概念-1
杰理之开 BLE 退出蓝牙模式卡机问题【篇】
从零安装Redis
Number theory --- fast power, fast power inverse element
input_delay
MySQL - common functions - string functions
【Socket】①Socket技术概述
uniapp适配问题
杰理之发射端在接收端关机之后假死机【篇】
What management points should be paid attention to when implementing MES management system
The solution of unable to create servlet file after idea restart
Remember the problem analysis of oom caused by a Jap query
Matlb| economic scheduling with energy storage, opportunity constraints and robust optimization