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!