wzpedison 发表于 2008-11-19 22:00

求助符号函数方程问题

function d1()
fid=fopen('d1.txt','w');
syms x y f o w
for x=0.5:0.5:10
    eqn=(1193.662074+1193.662074*i)*besselj(1,(.2513274122e-1+.2513274122e-1*i)*x^.5)/x^1.5/besselj(0,(.2513274122e-1+.2513274122e-1*i)*x^.5)/y/(1+(113.1768484+113.1768484*i)*besselj(1,(.2513274122e-1+.2513274122e-1*i)*x^.5)/x^1.5/besselj(0,(.2513274122e-1+.2513274122e-1*i)*x^.5)*log(1+1350.000000/(1.341640787+y^.5)^2))+(1.8-y)/(1.8+y);
    eq=vpa(eqn,4);
    f=solve(eq,y);
    fprintf(fid,'%f',x);
    fprintf(fid,'%s','      ');
    fprintf(fid,'%f',double(real(f)));
    fprintf(fid,'%s','      ');
    fprintf(fid,'%f',double(imag(f)));
    fprintf(fid,'%s\n','');
    clear maplemex;   
end
sta=fclose(fid);

运行后出现
Warning: Explicit solution could not be found.
> In solve at 140
In sym.solve at 49
In d1 at 6
??? Function 'eval' is not defined for values of class 'double'.

Error in ==> eval at 44
= builtin('eval', varargin{:});

Error in ==> sym.double at 45
D = reshape(eval(X),siz);

Error in ==> d1 at 9
    fprintf(fid,'%f',double(real(f)));
但是在maple中是有解的,
请高手帮忙!

无水1324 发表于 2008-11-20 09:59

回复 楼主 wzpedison 的帖子

我这里直接运行到死机了,
matlab的符号计算功能比maple的差远了,是不是这个方程在matlab里面找不到解呢?

octopussheng 发表于 2008-11-20 15:07

还是推荐maple求解,能有结果不就可以了么?
页: [1]
查看完整版本: 求助符号函数方程问题