On Jun 22, 9:17 am, "Liana " <liananapalk...@email.arizona.edu> wrote:
> Hi!
>
> My question is the following. There are two segment lines defined by two data sets. I need to know the deviation of the first curve from the second curve. For this purpose I suppose to use cosine angle. I want to go through the segment lines and estimate cosine angle stepbystep in case of any deviation. My code is the following:
>
> data_set1 = [1 1 2; 2 3 4; 2 1 1];
> data_set2 = [1 1 2; 2 4 4; 2 2 1];
> Cosine = dot(data_set1',data_set2')/(norm(data_set1')*norm(data_set2'));
> CosineInDegrees = acos(Cosine)*180/pi;
> Avg = sum(CosineInDegrees)/length(CosineInDegrees);
>
> Please give me a feedback if this is the correct and most efficient solution of the problem.
To check if this is correct, use a simple example
as starting point (e.g. vectors in the (x,y) plane)
and work out the solution by hand. If the results
from the hand computations and your program don't
match, ther is a problem somewhere. (NB: The converse
is *not* true!)
Rune
