MATLAB program to find the roots of an equation

조회 수: 2 (최근 30일)
Mohamed Adel
Mohamed Adel 2018년 7월 21일
댓글: Mohamed Adel 2018년 7월 21일
Write a MATLAB program to find the roots of the following equation for 0.2≤C≤2 (take ∆ C=0.1). Then plot the obtained roots versus the constant C. cos(x)=C*x
That's my try and I don't know what I did wrong
  댓글 수: 2
Steven Lord
Steven Lord 2018년 7월 21일
This sounds like a homework assignment. If you show us what you've tried already to solve the problem and ask a specific question about where you're having difficulty we may be able to offer suggestions for how to proceed.
Mohamed Adel
Mohamed Adel 2018년 7월 21일
I tried to use fsolve to determine the roots but I didn't get the roots That's my try I don't know what I did wrong

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

채택된 답변

Basil C.
Basil C. 2018년 7월 21일
Instead of using fsolve try using vpasolve
syms x
c=0.2:0.1:2;
y=cos(x)-c*x;
for i=1:numel(y)
sol(i)=vpasolve(y(i),x);
end
Now you can continue with plotting the graph
the approximate solution of each equation is stored in the variable sol

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by