필터 지우기
필터 지우기

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 (최근 30일)
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.

채택된 답변

Walter Roberson
Walter Roberson 2021년 5월 31일
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
shunmugam hemalatha
shunmugam hemalatha 2021년 5월 31일
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 2021년 5월 31일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

shunmugam hemalatha
shunmugam hemalatha 2021년 6월 2일
Thank You Sir.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by