I am not well verse in Matlab, and tried to run the code below. However, I keep getting an error stating "Not enough input arguments." I'm not sure what does this means.

1 view (last 30 days)
clear all
c0 =40;
cd = 50;
y0 = 0.09;
h = 0.7;
tow = 5;
u = 0.05;
a = 260;
b = 0.1;
syms T tow
%x = '((a*h)/2)+((a*tow*T)/3)+((a*h*T*((exp^(-u*tow))+b))/3)+((a*tow*(T^2)*((exp^(-u*tow))+b))/8)-(c0/(T^2))+(cd*((3*a*y0*(exp^(-u*tow)))-(2*T*a*b*y0*(exp^(-u*tow)))-(2*T*a*(b^2)))/6)';
%y ='1-((u*a*h*(T^2)*y0*(exp^(-u*tow)))/6)-((u*a*tow*(T^3)*y0*(exp^(-u*tow)))/24)-(cd*u*T*y0*(exp^(-u*tow))*((3*a-a*b*T)/6))';
%[T, tow]= solve ([x, y])
[solT,soltow] = solve ([((a*h)/2)+((a*tow*T)/3)+((a*h*T*((exp^(-u*tow))+b))/3)+((a*tow*(T^2)*((exp^(-u*tow))+b))/8)-(c0/(T^2))+(cd*((3*a*y0*(exp^(-u*tow)))-(2*T*a*b*y0*(exp^(-u*tow)))-(2*T*a*(b^2)))/6)==0, 1-((u*a*h*(T^2)*y0*(exp^(-u*tow)))/6)-((u*a*tow*(T^3)*y0*(exp^(-u*tow)))/24)-(cd*u*T*y0*(exp^(-u*tow))*((3*a-a*b*T)/6))==0], [T, tow])
TC = (c0/T)+(1/T)*(((a*h*(T^2))/2)+((a*tow*(T^3))/6)+((((a*y0*(exp^(-u*tow))+b)/2)*((h*(T^3)/3)+((tow*(T^4)/12))))))+(cd/T)*((((T^2)*y0*(exp^(-u*tow)))*(3*a-a*b*T))/6)+((tow*T)/T)
I need the answer: TC =230.390, T = 0.388 and tow = 48.420. Help me to find the answer.

Accepted Answer

Walter Roberson
Walter Roberson on 31 May 2021
In order to use
exp^(-u*tow)
You would need to have defined exp as a square array (including a scalar), or you would have had to have defined exp as a function that accepted no arguments.
If you were expecting exp to be the exponential, then do not use ^ : use
exp(-u*tow)
You could instead use
exp = exp(1);
and continue to use exp^ ... but that is not recommended, and would be less accurate than using exp() without the ^
  2 Comments
shunmugam hemalatha
shunmugam hemalatha on 31 May 2021
I agree your suggestion. That is by using exp() without the ^.
But I'm getting the answer like this
-0.0029562989695424121250461283911032
TC = tow + (((117*exp(-tow/20))/10 + 1/20)*((tow*T^4)/12 + (7*T^3)/30) + (130*T^3*tow)/3 + 91*T^2)/T + 40/T - (3*T*exp(-tow/20)*(26*T - 780))/4
Is there any mistake in coding. kindly, help me.
Walter Roberson
Walter Roberson on 31 May 2021
c0 =40;
cd = 50;
y0 = 0.09;
h = 0.7;
tow = 5;
u = 0.05;
a = 260;
b = 0.1;
syms T tow
[solT,soltow] = solve ([((a*h)/2)+((a*tow*T)/3)+((a*h*T*((exp(-u*tow))+b))/3)+((a*tow*(T^2)*((exp(-u*tow))+b))/8)-(c0/(T^2))+(cd*((3*a*y0*(exp(-u*tow)))-(2*T*a*b*y0*(exp(-u*tow)))-(2*T*a*(b^2)))/6)==0, 1-((u*a*h*(T^2)*y0*(exp(-u*tow)))/6)-((u*a*tow*(T^3)*y0*(exp(-u*tow)))/24)-(cd*u*T*y0*(exp(-u*tow))*((3*a-a*b*T)/6))==0], [T, tow])
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
solT = 
34.643023131338585589918914754588
soltow = 
TC = (c0/T)+(1/T)*(((a*h*(T^2))/2)+((a*tow*(T^3))/6)+((((a*y0*(exp(-u*tow))+b)/2)*((h*(T^3)/3)+((tow*(T^4)/12))))))+(cd/T)*((((T^2)*y0*(exp(-u*tow)))*(3*a-a*b*T))/6)+((tow*T)/T)
TC = 
subs(TC, [T, tow], [solT, soltow])
ans = 
3033.4109097492696411973724961761

Sign in to comment.

More Answers (1)

shunmugam hemalatha
shunmugam hemalatha on 2 Jun 2021
Thank You Sir.

Community Treasure Hunt

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

Start Hunting!