一段matlab程序,不知道哪里不对,
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/07/13 12:58:14
一段matlab程序,不知道哪里不对,
t=[1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010];
x=[566 632 745 755 769 789 985 1110 1313 1428 1782 1920 2150 2292 2601 3149 4338 5145 5809 6241 6854 7656 8772 10007 11374 12567 14332 16614 19228 22844 26404 29688 32074];
myfunc=inline('(566*beta(1))/(566*beta(2)+(beta(1)-566*beta(2))*exp(-beta(1)*(t-1978)))','beta','t');
beta=nlinfit(t,x,myfunc,[0 0]);
a=beta(1),b=beta(2)
%test the model
tt=min(X):max(x);
xx=(a-2*b*x)*(a-b*x)*x
plot(t,x,‘0‘,t,xx,'r')
显示?Error using ==> nlinfit at 113
Error evaluating inline model function.
Caused by:
Error using ==> inlineeval at 15
Error in inline expression ==> (566*beta(1))/(566*beta(2)+(beta(1)-566*beta(2))*exp(-beta(1)*(t-1978)))
Matrix dimensions must agree.
t=[1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010];
x=[566 632 745 755 769 789 985 1110 1313 1428 1782 1920 2150 2292 2601 3149 4338 5145 5809 6241 6854 7656 8772 10007 11374 12567 14332 16614 19228 22844 26404 29688 32074];
myfunc=inline('(566*beta(1))/(566*beta(2)+(beta(1)-566*beta(2))*exp(-beta(1)*(t-1978)))','beta','t');
beta=nlinfit(t,x,myfunc,[0 0]);
a=beta(1),b=beta(2)
%test the model
tt=min(X):max(x);
xx=(a-2*b*x)*(a-b*x)*x
plot(t,x,‘0‘,t,xx,'r')
显示?Error using ==> nlinfit at 113
Error evaluating inline model function.
Caused by:
Error using ==> inlineeval at 15
Error in inline expression ==> (566*beta(1))/(566*beta(2)+(beta(1)-566*beta(2))*exp(-beta(1)*(t-1978)))
Matrix dimensions must agree.
(566*beta(1))/(566*beta(2)+(beta(1)-566*beta(2))*exp(-beta(1)*(t-1978)))
这个表达式中数据的维数不对称,566*beta(1)应该是一个数吧,但是t却是一个数组,一个数除以一个数组怎么运算?
如果是数据元素分别运算,那么应该用./和.*运算,而不是/和*
再问: wuwu
这个表达式中数据的维数不对称,566*beta(1)应该是一个数吧,但是t却是一个数组,一个数除以一个数组怎么运算?
如果是数据元素分别运算,那么应该用./和.*运算,而不是/和*
再问: wuwu
一段matlab程序,不知道哪里不对,
matlab程序,不知道哪里出错了,显示为
matlab蒙特卡罗方法 不知道程序哪里错了,求助
matlab程序出现了错误,不知道哪里出错了
matlab编的程序出的图不对,不知道怎么回事.
帮忙计算一个画一个matlab图,我这个程序不知道哪里有错误.
小弟刚学习matlab,编了个程序,但是不知道为什么错误在哪里,
matlab 程序错误,不知道错在哪里,求高人教怎么修改
matlab程序如下,不知道哪里出错了,说矩阵维数不符合
求一段matlab程序
请教一段matlab程序.
matlab牛顿迭代法生成分形图,编好程序后运行总是出错,但不知道错在哪里,