Nonlinear equation numerical solution
    조회 수: 9 (최근 30일)
  
       이전 댓글 표시
    
Hi,
I have a following relation
C = 1.2;                         
D = 9420;                  
E = -2.0;                        
B = 0.1973;
f = D*sin(C*atan(B*x-E*(B*x-atan(B*x))));
and I would like to X if Y = 9250.
When I use below code:
syms x0 y0
y0 = 9250;
eqn = y0 == StiffnessMagicFormula(D,C,B,E,x0);
slip_angle = vpasolve(eqn, x0)
I obtained following result: 
slip_angle =
-4.1564971021120118282594483668007e191020734
But actually result should be around 6.8 .
I tryed also with functions: fsolve, roots and find but were all unsuccessful.
BR, Tadej
댓글 수: 0
답변 (2개)
  Matt J
      
      
 2020년 7월 21일
        
      편집: Matt J
      
      
 2020년 7월 21일
  
      I tryed also with functions: fsolve, roots and find but were all unsuccessful.
fsolve is overkill for such a simple 1D problem. Use fzero instead:
C = 1.2;                         
D = 9420;                  
E = -2.0;                        
B = 0.1973;
y0 = 9250;
f = @(x) D*sin(C*atan(B*x-E*(B*x-atan(B*x))))-y0;
x0=fzero(f,6.8)
For me, this results in
x0 =
    6.9606
댓글 수: 0
  Fabio Freschi
      
 2020년 7월 21일
        % params
C = 1.2;                         
D = 9420;                  
E = -2.0;                        
B = 0.1973;
y0 = 9250;
% function
fun = @(x)D*sin(C*atan(B*x-E*(B*x-atan(B*x))))-y0;
% solution
x0 = fsolve(fun,0)
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


