How to find a real positive root

8 次查看(过去 30 天)
How to find only the positive root of the equation x^3-A=0 for each A where A is a parameter varying like 1,2,3,....1000.
If alpha is the root, find the value of alpha/(alpha +1) for each case.

采纳的回答

Youssef  Khmou
Youssef Khmou 2013-4-15
编辑:Youssef Khmou 2013-4-15
hi, try this essay :
counter=1;
for A=1:100
f=@(x) x^3-A;
alpha=fzero(f,A);
if isa(alpha,'complex');
continue;
else
X(counter)=alpha;
Y(counter)=alpha/(alpha+1);
counter=counter+1;
end
end
figure, plot(Y);
  2 个评论
Atom
Atom 2013-4-15
编辑:Atom 2013-4-15
Thanks for your answer. If the equation is of higher degree having -ve root, then how to avoid the negative root as well in order to get only the positive root?
Youssef  Khmou
Youssef Khmou 2013-4-16
add the condition : if isa(alpha,'complex') && (g>=0)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by