nonlinear system of equations
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
Hello all, I want to solve for three variables: epsilon=m(1), Jr(epsilon)=m(2), dr=m(3); The equations are quite complicated, as follows: Pd=0.015, Fr=8900, Z=9, Kn=3.5893e+005; Equation 1: epsilon= 0.5*(1-0.5*Pd/dr) Equation 2: dr=Pd/2 + (Fr/(Z*Kn*Jr(epsilon))^(1/1.5) Equation 3: Jr(epsilon)=(1/2pi)*{integration(-th1 to th1)[1-(0.5/epsilon)*(1-cos(theta))]^(1.5)]*cos(theta)}; where th1=cosine inverse (Pd/(2dr)) Actually theta is not the variable, its limit just depend on dr the third variable in question.
To solve for this system, I have written following code: function [ n ] = loaddistr( m ) Fr=8900; Pd=0.015; Z=9; Kn=3.5893e+005; n=[m(1)-0.5*(1-0.5*Pd/m(3)); m(3)-Pd/2+(Fr/(Z*Kn*m(2)))^(1/1.5); m(2)-(0.5/pi)*int((1-(1/(2*m(1)))*(1-cos(theta)))^(1.5)*cos(theta), theta, -acosd(0.5*Pd/m(3)), acosd(0.5*Pd/m(3)))]; %UNTITLED Summary of this function goes here % Detailed explanation goes here
end
when I try to run this as m0=[0.42, 0.21512, 0.062283] p=fsolve(@loaddistr, m0)
I am getting following error: ??? Undefined function or variable 'theta'.
Error in ==> loaddistr at 6 n=[m(1)-0.5*(1-0.5*Pd/m(3)); m(3)-Pd/2+(Fr/(Z*Kn*m(2)))^(1/1.5);
Error in ==> fsolve at 248 fuser = feval(funfcn{3},x,varargin{:});
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
Can someone please tell me where I am going wrong. Is my approach is correct?
Thanks in advance,
Nikhil
댓글 수: 4
Matt J
2013년 10월 5일
Please highlight and format your code using the

toolbar button. Currently, it is not readable.
Nikhil
2013년 10월 5일
Nikhil
2013년 10월 5일
Mohammad Monfared
2013년 10월 6일
I think you can define an anonymous function earlier in your main function, hence fun became like:
function [ n ] = loaddistr( m )
Fr=8900; Pd=0.015; Z=9; Kn=3.5893e+005;
FUN=@(theta)(1-(1/(2*m(1)))*(1-cos(theta)))^(1.5)*cos(theta);
n=[m(1)-0.5*(1-0.5*Pd/m(3));
m(3)-Pd/2+(Fr/(Z*Kn*m(2)))^(1/1.5);
m(2)-(0.5/pi)*integral(FUN, -acosd(0.5*Pd/m(3)), acosd(0.5*Pd/m(3)))];
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!