matlab中Index exceeds matrix dimensions.错误
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/07/13 01:06:50
matlab中Index exceeds matrix dimensions.错误
function [x,m]=g1(x)
syms z k m x h
z(1)=30;
z(2)=68;
z(3)=75;
z(4)=82;
z(5)=82;
z(6)=77;
z(7)=68;
z(8)=68;
z(9)=58;
z(10)=51;
z(11)=50;
z(12)=41;
z(13)=38;
z(14)=35;
z(15)=28;
z(16)=25;
z(17)=18;
z(18)=15;
z(19)=12;
z(20)=10;
z(21)=7;
z(22)=7;
z(23)=4;
m=0;
h=0.25;
for k=4:x(2)
m=m+z(k-1)-z(k)-x(1)*h/24*(9*z(k)+19*z(k-1)-5*z(k-2)+z(k-3));
end
function [x,m]=gg(x)
syms m h1 h2 h3 i d y x
m=0;
d=2*0.13;
h1=0.25;
h2=0.5;
h3=1;
for i=5:5
y=[x(1),i];
m=m+(d*((1-x(2)*h1)^(i-1)-(1-x(2)*h1)^2)-g1(y))^2;
end
for i=6:12
y=[x(1),i];
m=m+(d*((1-x(2)*h2)^(i-1)-(1-x(2)*h2)^2)-g2(y))^2;
end
for i=13:23
y=[x(1),i];
m=m+(d*((1-x(2)*h3)^(i-1)-(1-x(2)*h3)^2)-g3(y))^2;
end
syms x0 x
x0=[0,0];
x=fminunc(gg,x0)
结果运行显示Index exceeds matrix dimensions.怎么回事?
function [x,m]=g1(x)
syms z k m x h
z(1)=30;
z(2)=68;
z(3)=75;
z(4)=82;
z(5)=82;
z(6)=77;
z(7)=68;
z(8)=68;
z(9)=58;
z(10)=51;
z(11)=50;
z(12)=41;
z(13)=38;
z(14)=35;
z(15)=28;
z(16)=25;
z(17)=18;
z(18)=15;
z(19)=12;
z(20)=10;
z(21)=7;
z(22)=7;
z(23)=4;
m=0;
h=0.25;
for k=4:x(2)
m=m+z(k-1)-z(k)-x(1)*h/24*(9*z(k)+19*z(k-1)-5*z(k-2)+z(k-3));
end
function [x,m]=gg(x)
syms m h1 h2 h3 i d y x
m=0;
d=2*0.13;
h1=0.25;
h2=0.5;
h3=1;
for i=5:5
y=[x(1),i];
m=m+(d*((1-x(2)*h1)^(i-1)-(1-x(2)*h1)^2)-g1(y))^2;
end
for i=6:12
y=[x(1),i];
m=m+(d*((1-x(2)*h2)^(i-1)-(1-x(2)*h2)^2)-g2(y))^2;
end
for i=13:23
y=[x(1),i];
m=m+(d*((1-x(2)*h3)^(i-1)-(1-x(2)*h3)^2)-g3(y))^2;
end
syms x0 x
x0=[0,0];
x=fminunc(gg,x0)
结果运行显示Index exceeds matrix dimensions.怎么回事?
Index exceeds matrix dimensions
指针超过矩阵的大小
是你的常量设置过多超过矩阵大小
指针超过矩阵的大小
是你的常量设置过多超过矩阵大小
matlab中Index exceeds matrix dimensions.错误
MATLAB 中 Index exceeds matrix dimensions.错误
matlab中,Index exceeds matrix dimensions错误问题
matlab中Index exceeds matrix dimensions
matlab Index exceeds matrix dimensions.
Matlab计算Index exceeds matrix dimensions.为什么?
MATLAB Index exceeds matrix dimensions问题
Matlab计算Index exceeds matrix dimensions.为什么?...
matlab的问题?Index exceeds matrix dimensions.
Index exceeds matrix dimensions.什么错误啊?
Index exceeds matrix dimensions.
matlab的问题:关于Index exceeds matrix dimensions.