matlab Function value and YDATA sizes are incommensurate M文件:function f=myfunc(D,t)syms n t; x=1/n^2*exp((-1)*D*n^2*pi^2*t/0.0002^2);s=symsum(x,n,1,100);f=1-6/pi^2*s; end主程序:t=[180 420 780 1080 1380 1680 1920 2220 2520 2820 3120 3420 37
来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 15:38:54
matlab Function value and YDATA sizes are incommensurate M文件:function f=myfunc(D,t)syms n t; x=1/n^2*exp((-1)*D*n^2*pi^2*t/0.0002^2);s=symsum(x,n,1,100);f=1-6/pi^2*s; end主程序:t=[180 420 780 1080 1380 1680 1920 2220 2520 2820 3120 3420 37
matlab Function value and YDATA sizes are incommensurate
M文件:function f=myfunc(D,t)syms n t; x=1/n^2*exp((-1)*D*n^2*pi^2*t/0.0002^2);s=symsum(x,n,1,100);f=1-6/pi^2*s; end主程序:t=[180 420 780 1080 1380 1680 1920 2220 2520 2820 3120 3420 3720 4020 4380 4680 4980 5280];c=[0.08762 0.20444 0.36545 0.48247 0.59 0.67602 0.75 0.80407 0.86 0.9 0.94 0.96831 0.98561 0.99 0.99968 0.999999 1 1];D0=[0.001];D=lsqcurvefit(@myfunc,D0,t,c);f=myfunc(D,t);错误:Error using lsqcurvefit (line 247)Function value and YDATA sizes are incommensurate.是想通过非线性拟合求D.有t,c数据,方程是一个求和方程.
matlab Function value and YDATA sizes are incommensurate M文件:function f=myfunc(D,t)syms n t; x=1/n^2*exp((-1)*D*n^2*pi^2*t/0.0002^2);s=symsum(x,n,1,100);f=1-6/pi^2*s; end主程序:t=[180 420 780 1080 1380 1680 1920 2220 2520 2820 3120 3420 37
修改后的代码在附件里,可以直接运行该m文件.