Hi I wrote the below program. when I run it,Matlab give me this error: Error using integral_thermalmoment (line 4) Not enough input arguments. How I can fix it. thank you
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hi I wrote the below program. when I run it,Matlab give me this error: Error using integral_thermalmoment (line 4) Not enough input arguments.
How I can fix it. thank you
this is my program :
function [M1,M2 ,M3 ,M4 ,M5 ,M6 ,M7 ,M8]=integral_thermalmoment(h1, h2, h3)
syms z Ehc Eh nn v alpha_hc alpha_h TL Tu Tc Tm T0 H kmc kc
if h1~=0 && h2~=0 && h3==0
M1=0;
M2=0;
M3=z*(Tc-T0)*(((alpha_hc)+((alpha_h)-(alpha_hc))*(0.5*(((2*z)-(-h1-h2))/h2)^nn)))*...
((Ehc+(Eh-Ehc)*(0.5*(((2*z)-(-h1-h2))/h2)^nn)));
M3=int(M3,z);
M4=z*(Tc-T0)*(((alpha_hc)+((alpha_h)-(alpha_hc))*(1-0.5*((-2*z+(h2-h1))/h2)^nn)))*...
((Ehc+(Eh-Ehc)*(1-0.5*(((-2*z)+(h2-h1))/h2)^nn)));
M4=int(M4,z);
M5=z*(Tm-Tc)*((1/H)*(((1/2)*((2*z-(-h1-h2))/h2))-...
((kmc/((nn+1)*kc))*((1/2)*((2*z-(-h1-h2))/h2)^(nn+1)))+...
(kmc^2/((2*nn+1)*kc^2)*((1/2)*((2*z-(-h1-h2))/h2)^(2*nn+1)))-...
(kmc^3/((3*nn+1)*kc^3)*((1/2)*((2*z-(-h1-h2))/h2)^(3*nn+1)))+...
(kmc^4/((4*nn+1)*kc^4)*((1/2)*((2*z-(-h1-h2))/h2)^(4*nn+1)))-...
(kmc^5/((5*nn+1)*kc^5)*((1/2)*((2*z-(-h1-h2))/h2)^(5*nn+1)))))*...
(((alpha_hc)+((alpha_h)-(alpha_hc))*(0.5*((2*z-(-h1-h2))/h2)^nn)))*...
((Ehc+(Eh-Ehc)*(0.5*(((2*z)-(-h1-h2))/h2)^nn)));
M5=int(M5,z);
M6=z*(Tm-Tc)*((1/H)*(((1-(1/2)*((-2*z+(-h1+h2))/h2)))-...
(kmc/((nn+1)*kc)*(1-(1/2)*((-2*z+(-h1+h2))/h2)^(nn+1)))+...
(kmc^2/((2*nn+1)*kc^2)*(1-(1/2)*((-2*z+(-h1+h2))/h2)^(2*nn+1)))-...
(kmc^3/((3*nn+1)*kc^3)*(1-(1/2)*((-2*z+(-h1+h2))/h2)^(3*nn+1)))+...
(kmc^4/((4*nn+1)*kc^4)*(1-(1/2)*((-2*z+(-h1+h2))/h2)^(4*nn+1)))-...
(kmc^5/((5*nn+1)*kc^5)*(1-(1/2)*((-2*z+(-h1+h2))/h2)^(5*nn+1)))))*...
(((alpha_hc)+((alpha_h)-(alpha_hc))*(1-0.5*((-2*z+(h2-h1))/h2)^nn)))*...
((Ehc+(Eh-Ehc)*(1-0.5*((-2*z+(h2-h1))/h2)^nn)));
M6=int(M6,z);
M7=z*((1/h1)*((((h1+h2)/2)*TL-((h2-h1)/2)*Tm)+(Tm-TL)*z))*(alpha_h)*(Eh);
M7=int(M7,z);
M8=-z*T0*(alpha_h)*(Eh);
M8=int(M8,z);
elseif h1~=0 && h2==0 && h3~=0
M1=z*((1/h3)*((((h3-h1)/2)*Tc-(-(h1+h3)/2)*Tu)+(Tu-Tc)*z))*(alpha_hc)*(Ehc);
M1=int(M1,z);
M2=-z*T0*(alpha_hc)*(Ehc);
M2=int(M2,z);
M3=0;
M4=0;
M5=0;
M6=0;
M7=z*((1/h1)*((((h1+h3)/2)*TL-((h3-h1)/2)*Tm)+(Tm-TL)*z))*(alpha_h)*(Eh);
M7=int(M7,z);
M8=-z*T0*(alpha_h)*(Eh);
M8=int(M8,z);
elseif h1~=0 && h2~=0 && h3~=0
M1=z*((1/h3)*((((h3-h1-h2)/2)*Tc-(-(h1+h2+h3)/2)*Tu)+(Tu-Tc)*z))*(alpha_hc)*(Ehc);
M1=int(M1,z);
M2=-z*T0*(alpha_hc)*(Ehc);
M2=int(M2,z);
M3=z*(Tc-T0)*(((alpha_hc)+((alpha_h)-(alpha_hc))*(0.5*(((2*z)-(h3-h1-h2))/h2)^nn)))*...
((Ehc+(Eh-Ehc)*(0.5*(((2*z)-(h3-h1-h2))/h2)^nn)));
M3=int(M3,z);
M4=z*(Tc-T0)*(((alpha_hc)+((alpha_h)-(alpha_hc))*(1-0.5*((-2*z+(h2+h3-h1))/h2)^nn)))*...
((Ehc+(Eh-Ehc)*(1-0.5*(((-2*z)+(h2+h3-h1))/h2)^nn)));
M4=int(M4,z);
M5=z*(Tm-Tc)*((1/H)*(((1/2)*((2*z-(h3-h1-h2))/h2))-...
((kmc/((nn+1)*kc))*((1/2)*((2*z-(h3-h1-h2))/h2)^(nn+1)))+...
(kmc^2/((2*nn+1)*kc^2)*((1/2)*((2*z-(h3-h1-h2))/h2)^(2*nn+1)))-...
(kmc^3/((3*nn+1)*kc^3)*((1/2)*((2*z-(h3-h1-h2))/h2)^(3*nn+1)))+...
(kmc^4/((4*nn+1)*kc^4)*((1/2)*((2*z-(h3-h1-h2))/h2)^(4*nn+1)))-...
(kmc^5/((5*nn+1)*kc^5)*((1/2)*((2*z-(h3-h1-h2))/h2)^(5*nn+1)))))*...
(((alpha_hc)+((alpha_h)-(alpha_hc))*(0.5*((2*z-(h3-h1-h2))/h2)^nn)))*...
((Ehc+(Eh-Ehc)*(0.5*(((2*z)-(h3-h1-h2))/h2)^nn)));
M5=int(M5,z);
M6=z*(Tm-Tc)*((1/H)*(((1-(1/2)*((-2*z+(h3-h1+h2))/h2)))-...
(kmc/((nn+1)*kc)*(1-(1/2)*((-2*z+(h3-h1+h2))/h2)^(nn+1)))+...
(kmc^2/((2*nn+1)*kc^2)*(1-(1/2)*((-2*z+(h3-h1+h2))/h2)^(2*nn+1)))-...
(kmc^3/((3*nn+1)*kc^3)*(1-(1/2)*((-2*z+(h3-h1+h2))/h2)^(3*nn+1)))+...
(kmc^4/((4*nn+1)*kc^4)*(1-(1/2)*((-2*z+(h3-h1+h2))/h2)^(4*nn+1)))-...
(kmc^5/((5*nn+1)*kc^5)*(1-(1/2)*((-2*z+(h3-h1+h2))/h2)^(5*nn+1)))))*...
(((alpha_hc)+((alpha_h)-(alpha_hc))*(1-0.5*((-2*z+(h2+h3-h1))/h2)^nn)))*...
((Ehc+(Eh-Ehc)*(1-0.5*((-2*z+(h2+h3-h1))/h2)^nn)));
M6=int(M6,z);
M7=z*((1/h1)*((((h1+h2+h3)/2)*TL-((h2+h3-h1)/2)*Tm)+(Tm-TL)*z))*(alpha_h)*(Eh);
M7=int(M7,z);
M8=-z*T0*(alpha_h)*(Eh);
M8=int(M8,z);
end
end
Answers (1)
Geoff Hayes
on 22 Feb 2015
reza - the error message is telling you that you are not providing enough input arguments when trying to call the function integral_thermalmoment. Note its signature is
function [M1,M2 ,M3 ,M4 ,M5 ,M6 ,M7 ,M8]=integral_thermalmoment(h1, h2, h3)
and so expects three inputs h1, h2, and h3. How are you calling this function and are you providing three inputs when you do so?
This question is closed.
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!