필터 지우기
필터 지우기

how to solve this equation?

조회 수: 2 (최근 30일)
Ankit agrawal
Ankit agrawal 2015년 9월 6일
편집: Mohammad Abouali 2015년 9월 6일
(1+cost)(tcost-sint)=2K(sint^2), where k is a constant

채택된 답변

Mohammad Abouali
Mohammad Abouali 2015년 9월 6일
편집: Mohammad Abouali 2015년 9월 6일
well a quick look at the equation, t=0 is always the solution regardless of the value of K.
However, if you want to solve these numerically you can choose an approach like below:
K=2;
fun=@(t) (1+cos(t)).*(t.*cos(t)-sin(t))-2*K*(sin(t).^2);
% or the following. Not sure which one you want.
% fun=@(t) (1+cos(t)).*(t.*cos(t)-sin(t))-2*K*(sin(t.^2));
Options=optimset(@fsolve);
Options.TolFun=1e-10;
[x,fval,exitflag,output] = fsolve(fun,1,Options)
x =
1.4560e-04
fval =
-8.4804e-08
exitflag =
1
output =
iterations: 12
funcCount: 26
algorithm: 'trust-region-dogleg'
firstorderopt: 9.8791e-11
message: 'Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the selected valu...'
  댓글 수: 2
Ankit agrawal
Ankit agrawal 2015년 9월 6일
many thanks for the solution ...can i plot this equation in a graph....in the domain(1, pi/2)
Mohammad Abouali
Mohammad Abouali 2015년 9월 6일
편집: Mohammad Abouali 2015년 9월 6일
Sure you can.
K=2;
fun1=@(t) (1+cos(t)).*(t.*cos(t)-sin(t));
fun2=@(t) 2*K*(sin(t.^2));
ezplot(fun1,[1,pi])
hold on
h=ezplot(fun2,[1,pi]);
set(h,'Color','r')
legend('(1+cost)(tcost-sint)','2K(sint^2)')
where fun is your function defined in previous code.
BTW, if you are interested in the solution between the [1,pi] you can use fminbnd function as follow:
fminbnd(fun,1,pi)
ans =
1.2915
fminbnd(fun,1.3,pi)
ans =
2.7949

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by