How to find points of intersections of graphs?

Hi everybody. I need to find zeros of given functions of one (and the same) variable in given interval. f_k(t)=1-cos(a_k*t-b_k), -Pi<t<Pi, k=1,2,...,n (n is a given integer), a_k and b_k are known.
I thought to draw graphics of that functions and find the points of their intersections. But I could just draw graphics, and could not find that points. Could you help me with graphics or advice another way of solution?

2 Comments

Matt Fig
Matt Fig on 15 Dec 2012
Edited: Matt Fig on 15 Dec 2012
The question is a little unclear. Do you mean that for each integer k on [1,n] you want to find where 1-cos(a(k)*t-b(k)) intersects all of the other 1-cos(a(d)*t-b(d)), d~=k, d on [1,n]?
How many long is a and b? Can you show them?
Yes, you`re right. I can right down only a_k here: a_k=(Pi*k)^2/sqrt(1+c*(Pi*k)^2), where c is given constant. b_k are of the arctan() form.

Sign in to comment.

 Accepted Answer

pas=0.01
t=-pi:pas:pi;
n=length(t);
a_k=[1 2 3 4];
b_k=[1 2 3 4];
for k=1:numel(a_k)
f_k{k}=1-cos(a_k(k)*t-b_k(k));
[c,idx1]=findpeaks(-f_k{k})
tzeros{k}=t(idx1)
end

7 Comments

Thank you for response. But could you, please, explain your answer?
Ok,I've noticed that the zeros of your function f_k corresponds to its minima. findpeaks function will find the maxima of your function f_k, then I used findpeaks(-f_k) to find a minimum.
[c,idx]=findpeaks(-f)
% c are the minimum
% idx are indexes corresponding to each minimum
Matt Fig
Matt Fig on 15 Dec 2012
Edited: Matt Fig on 15 Dec 2012
This Answer does not match at all with what you said above in the comments. It finds the minimum (zero) of the given function for each k individually. Above you said you meant something entirely different! Perhaps there is a communication problem.
You are right, I don`t need solution for EACH k (it is very obvious: t_j=(2*Pi*j+b_k)/a_k), I need the solution of the one-parametric SYSTEM 1-cos(a_k*t-b_k)=0, k=1,2,...,n in -Pi<t<Pi interval, which should satisfy all that equations simultaneously. I think, that graphical method suits the best.
you can choose the intersection of vectors in tzeros. In your case it's t0=0.9984
Haw can I check your algorithm (the problem is that I`m just a beginner)?
tzeros{1} is the vector time result for k=1
tzeros{2} is the vector time result for k=2
and so on

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!