Info

This question is closed. Reopen it to edit or answer.

dsolve error occurs on every computer except for one.

1 view (last 30 days)
Michael
Michael on 25 Nov 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello,
I have the following function:
function [ out] = LHeat( q,rho, V, cp, h, As, Tstart,Tinf,tat )
equal = strcat('Dg==','(',num2str(q),'-',num2str(h),'*',num2str(As),'*(g-',num2str(Tinf),'))/(',num2str(rho),'*',num2str(V),'*',num2str(cp),')');
an=dsolve(equal,strcat('g(0)=',num2str(Tstart)),'t');
out= subs(an,'t',tat);
end
I call this function in a longer code. The input values are all just constants. However, while it works on the computer I wrote it on, but on any other computer, I get the following error:
%%% START OF ERROR %%%%
Error using sym>convertExpression (line 2576)
Conversion to 'sym' returned the MuPAD error: Error: ')'
expected [line 1, col 14]
Error in sym>convertChar (line 2487)
s = convertExpression(x);
Error in sym>convertCharWithOption (line 2470)
s = convertChar(x);
Error in sym>tomupad (line 2224)
S = convertCharWithOption(x,a);
Error in sym (line 111)
S.s = tomupad(x,'');
Error in dsolve>mupadDsolve (line 254)
sys = sym(sys_str);
Error in dsolve (line 153)
sol = mupadDsolve(args, options);
Error in LHeat (line 5)
an=dsolve(equal,strcat('g(0)=',num2str(Tstart)),'t');
Error in CalibratedPyro1018A (line 109)
lump(i+1)=LHeat(qin,rho,v,cp,h(i),As,lump(i),Tinf,1);
% Finding the temperature
%%%% ERROR OVER %%%%%
The error is in how I am making my equation for DSolve, but I can not figure out how to fix it. Any help would be much appreciated.
  1 Comment
Michael
Michael on 26 Nov 2013
I used the fix you recommended and am still getting the following error:
Error using sym>convertExpression (line 2576) Conversion to 'sym' returned the MuPAD error: Error: ']' expected [line 1, col 11]
Error in sym>convertChar (line 2487) s = convertExpression(x);
Error in sym>convertCharWithOption (line 2470) s = convertChar(x);
Error in sym>tomupad (line 2224) S = convertCharWithOption(x,a);
Error in sym (line 111) S.s = tomupad(x,'');
Error in sym/horzcat (line 17) args{k} = sym(args{k});
Error in dsolve>mupadDsolve (line 253) sys_str = ['[' sys{1:end-1} ']'];
Error in dsolve (line 153) sol = mupadDsolve(args, options);
Error in LHeat (line 4) an = dsolve(equal,subs(sym('g(0)=Tstart'),'Tstart',Tstart),'t');
Error in CalibratedPyro1018A (line 109) lump(i+1)=LHeat(qin,rho,v,cp,h(i),As,lump(i),Tinf,1); % Finding the temperature

Answers (1)

Walter Roberson
Walter Roberson on 25 Nov 2013
I suggest adjusting the LHeat code from
an=dsolve(equal,strcat('g(0)=',num2str(Tstart)),'t');
to
an = dsolve(equal,subs(sym('g(0)=Tstart'),'Tstart',Tstart),'t');

Community Treasure Hunt

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

Start Hunting!