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

Rik
Rik 2021년 1월 21일
Edit restored from Google cache and thread archived.
@Murad Khalilov Editing away your question after receiving an answer is extremely rude. Please don't do it again.
Murad Khalilov
Murad Khalilov 2021년 1월 21일
actually I want to delete this question, becuase this can be problem for me in future
Rik
Rik 2021년 1월 21일
What kinds of problems? Please explain your reasons to have this question deleted.
I don't see how this is copyrighted material. So the only way I can see this causing problems is if you used this forum to cheat.
Murad Khalilov
Murad Khalilov 2021년 1월 21일
this is one of my exam question, and if my professor see this forum, he make me fail, and complain me to academic comittee as academic fraud, I think you can understand my situation
Rik
Rik 2021년 1월 21일
If you use the answers here and pass them off as your own work, isn't that fraud? You didn't mention from the start this was homework.
If you mentioned you were using code by someone else, this should not count as fraud. However, if you passed this off as your own work, why would that be anything other than fraud?
I would say you are currently learning a very important lesson.
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일

0 개 추천

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일

0 개 추천

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월 20일
"fixed points" means f(x)=x -- the place where applying the function to a point gives back the same location.
So not the point where f(x) = 0, but rather the point where f(x)-x = 0
It wasn’t immediately obvious to me how to code that. (It’s been a long day!)
Try this:
f = @(x) cos(x) - 0.07 * x.^2;
tv = linspace(-50, 50, 1000);
fv = f(tv);
zvi = find(diff(sign(fv-tv)));
for k = 1:numel(zvi)
idxrng = [max([1 zvi(k)-1]):min([numel(tv) zvi(k)+1])];
indv = tv(idxrng);
depv = fv(idxrng)-indv;
B = [indv(:) ones(numel(idxrng),1)] \ depv(:);
zx(k) = -B(2)/B(1);
end
figure
plot(tv, fv, '-b')
hold on
plot(zx, f(zx), '+r', 'MarkerSize',15)
hold off
grid
xlim([-20 10])
text(zx, f(zx), compose(' \\leftarrow (%.3f, %.3f)',[zx; f(zx)].'), 'VerticalAlignment','middle','HorizontalAlignment','left', 'FontWeight','bold')
legend('Function Value','Fixed Points', 'Location','S')
producing:
.
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.

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

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

질문:

2021년 1월 20일

댓글:

Rik
2021년 1월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by