王佳敏的回答:no need to use simpson for integration. since simpson is a numerical method, you just pass the initial value,final value to the fucntion, that is enough.. 苏世明的回答:no need to use simpson for integration. since simpson is a numerical method, you just pass the initial value,final value to the fucntion, that is enough.. 糯米鸡的回答:你的这个问题,错在这一句:t=b.^2*pi^2*10^(-3)*r^4*0.25.*p/(r^2+p.^2); “b.^2*pi^2*10^(-3)*r^4*0.25.*p” 是个向量吧?“r^2+p.^2”也是向量吧? 那应该用“./”呀,你前面都用了,怎么到这儿粗心了呢。 改一下就可以了:t=b.^2*pi^2*10^(-3)*r^4*0.25.*p./(r^2+p.^2); 你后面的运算没有报错,是因为用“/”也能算出t的值来的 相当于2个向量相除,解出的t值只有一个值,并不是个向量 而你后面再用t=t.*p;运算,相当于人为又把t变成向量了 但不是t本来的值。虽然没报错,但结果应该不是很准确 也有可能当r取一定值时,结果比较接近。 反正,我试了一下,2种积分的结果相差倒是不大,主要是不知道你b的定义。 |