how to fin dalta from this equation
조회 수: 2 (최근 30일)
이전 댓글 표시
how to solve this equation attached to file
댓글 수: 1
KALYAN ACHARJYA
2018년 4월 11일
편집: KALYAN ACHARJYA
2018년 4월 11일
Good Question
x+c1cosx=c2 solve for x?
where c1, c2 constant.
답변 (1개)
David Goodmanson
2018년 4월 12일
Hello Hussein,
A plot of the equation shows that there are three real roots:
x = -2:.001:6;
figure(1)
y = x + 1.6*cos(x)-1.303;
plot(x,y)
Of the many ways to find the roots, just for fun the method below finds a new x value from the present value and iterates. One could keep track of progress and stop after a certain tolerance was reached, but this method is so fast that it's easier to run the for loop a lot of times and verify the accuracy after that. For this root, you can guess basically anything for the starting value of x.
The final result shows 0 for the imaginary part so taking x = real(x) is justified.
You can see that their value of 2.08 is not very good, although it's possible that they were carrying more significant figures than they showed on their next-to-last-line.
format long
x = 4; % starting point
for k = 1:400
x = acos((1.303-x)/1.6);
end
x
x = real(x);
accuracy_check = x+1.6*cos(x)-1.303
x = 2.072569688766171 - 0.000000000000000i
accuracy_check = 2.220446049250313e-16
If you want to obtain the other two roots then you would iterate on
x = 1.303-1.6*cos(x);
in which case the initial value for x determines which root you get.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!