All fixed points of function

27 次查看(过去 30 天)
Murad Khalilov
Murad Khalilov 2021-1-20
评论: Rik 2021-1-21
Hello,
how can I find all fixed points of following function: f(x) = cos(x) - 0.07 * x^2. question is so: find all fixed points of this function: f(x)=x.
please, help me, I use roots function but this is not work because I dont know coefficent of cos(x)
Thanks in advance
  7 个评论
Murad Khalilov
Murad Khalilov 2021-1-21
I dont use any code from here, because this is only small part of general task, I only want direction from others, but some codes are not useful for me, this is not fraud, but I dont want that my professor see this post, and also I dont need to show anyone's code as mine, this is not gentle behaviour, also it is not needed to continue this conversation, I only want to delete this forum, if it is not possible, okay, keep so
Rik
Rik 2021-1-21
If you are not comitting fraud you should not have anything to worry about.

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2021-1-20
syms x
f(x) = cos(x) - 0.07 * x^2;
fplot([f(x)-x,0], [-15 15])
Now you can vpasolve() giving a starting point near a value you read from the graph.
You cannot use roots() for this, as it is not a polynomial.

Star Strider
Star Strider 2021-1-20
编辑:Star Strider 2021-1-20
If by ‘fixed points’ you intend ‘roots’, try this:
f = @(x) cos(x) - 0.07 * x.^2;
tv = linspace(-10, 10);
fv = f(tv);
zvi = find(diff(sign(fv)));
for k = 1:numel(zvi)
idxrng = [max([1 zvi(k)-1]):min([numel(tv) zvi(k)+1])];
indv = tv(idxrng);
depv = fv(idxrng);
B = [indv(:) ones(3,1)] \ depv(:);
zx(k) = B(2)/B(1);
end
figure
plot(tv, fv, '-b')
hold on
plot(zx, zeros(size(zx)), 'xr')
hold off
grid
legend('Function Value','Roots', 'Location','S')
EDIT —
Added plot image:
.
  4 个评论
Walter Roberson
Walter Roberson 2021-1-21
This appears to be a homework question... which is why I chopped out the two exact solutions I was in the middle of posting, and replaced it with a description of strategy instead of complete code.
Star Strider
Star Strider 2021-1-21
Didn’t pick up on that.
Still, an interesting problem that I’d not considred previously, and enjoyed solving.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by