code works in input but not when in a script

1 次查看(过去 30 天)
i have a section of coding that works fine when i type it in directly but reports errors and never finishes running when in a script. the section in the script is
c=Z(1,c2);
syms x
sl1 = solve (cosh(x/(2*c)-(3*c)^2+5)==x);
SOL(1,c2)= sl1 ;
c2=c2+1;
it reports a problem with the line 'd = solve...' and errors within the solve command. i cant figure out whats wrong with it as when i type it in the main matlab command line it works fine. the exact errors are
In mupadengine/feval (line 150)
[S,err] = evalin(engine,stmt);
In solve (line 170)
sol = eng.feval('symobj::solvefull',eqns,vars);
In Untitled (line 9)
d = solve (tanh(x/(2*b))==x);
completely stumped so any help would be brilliant,thanks

回答(1 个)

Walter Roberson
Walter Roberson 2013-12-13
Do not have a space between "solve" and the "(".

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by