Em Andamento

Need algorithm in X-code

Hello!

I have to process an array of informations in Xcode. Please find the detailed project description on the description side. Here only a short overview of the kind of data which have to be processed and the formula which have to be used.

-42 571

-41 543

-40 513

-39 483

-38 453

-37 423

-36 393

-32 361

-28 330

-27 302

-23 270

-22 242

-21 211

-20 181

-16 151

-11 121

-6 91

-5 59

-4 30

result = 3600*(TAN((first_value_of_present_line - first_value_of_line_before)*Pi/180)/ABS((second_value_of_present_line - second_value_of_line_before)))

(please find the detailed project description below in 'Requirements')

## Deliverables

I have to process an array of informations in Xcode. Below you can see an example of the data that has to be processed. The different lines each contain the value of an angle (in degree) and a timestamp (in ms). So let me describe step by step how this data have to be processed. I start with the first step behind the data set. So please scroll down...

?

-42 571

-42 571

-42 571

-42 571

-41 543

-40 513

-39 483

-38 453

-37 423

-36 393

-32 361

-32 361

-32 361

-32 361

-28 330

-28 330

-28 330

-28 330

-27 302

-23 270

-23 270

-23 270

-23 270

-22 242

-21 211

-20 181

-16 151

-16 151

-16 151

-16 151

-11 121

-11 121

-11 121

-11 121

-11 121

-6 91

-6 91

-6 91

-6 91

-6 91

-5 59

-4 30

1 0

1 0

1 0

1 0

1 0

2 33

6 60

6 60

6 60

6 60

7 90

8 121

9 150

10 180

11 210

12 274

13 303

14 334

15 363

16 396

17 427

21 457

21 457

21 457

21 457

22 496

26 520

26 520

26 520

26 520

27 552

28 580

29 612

33 640

33 640

33 640

33 640

34 671

38 701

38 701

38 701

38 701

39 731

43 761

43 761

43 761

43 761

44 792

48 824

1. The first step is easy. Just delete all double lines. So the result in this example would be

-42 571

-41 543

-40 513

-39 483

-38 453

-37 423

-36 393

-32 361

-28 330

-27 302

-23 270

-22 242

-21 211

-20 181

-16 151

-11 121

-6 91

-5 59

-4 30

1 0

2 33

6 60

7 90

8 121

9 150

10 180

11 210

12 274

13 303

14 334

15 363

16 396

17 427

21 457

22 496

26 520

27 552

28 580

29 612

33 640

34 671

38 701

39 731

43 761

44 792

48 824

2. In the second step there should be calculated a value between the lines. Just let me tell you the formula you need:

= 3600*(TAN((first_value_of_present_line - first_value_of_line_before)*Pi/180)/ABS((second_value_of_present_line - second_value_of_line_before)))

Attention: There are two MINUS in that formula. Do not miss them.

So, let us have a look to the very first line -41,571. Can you use the formula here? No, you cannot. Because it is the first line and you also need the values from the line before. So we have to start with line 2. Now I will put the values from line two into the formula. Now we have:

= 3600*(TAN((-41 -? -42)*Pi/180)/ABS((543 - 571)))

= 2.24

All results from the first (second) line down to the end are

2.24

2.09

2.09

2.09

2.09

2.09

7.87

8.12

2.24

7.87

2.24

2.03

2.09

8.39

10.5

10.5

1.96

2.17

10.5

2

9.32

2.09

2.03

2.17

2.09

2.09

0.98

2.17

2.03

2.17

1.9

2.03

8.39

1.61

10.49

1.96

2.24

1.96

8.99

2.03

8.39

2.09

8.39

2.03

7.87

3. The third step is very easy: Find the maximum! Okay, it is obviously 10.5 and we can find it twice.

4. The last step is a control step to find out if the found maximum is 'healthy'. For that just compare the values before and after the found maximum. Let's start with the first maximum. The value before it is 8.39. The other value is 10.5, the second maximum (this is just an accident that in this example is a second maximum and that there are nearby). So, the control step is to check if neither the value before (8.39) nor the value after it (10.5) is less than the half of the maximum. Here the found maximum is fine and the algorithm finishes.

The second maximum would not pass the control step because the following value is 1.96 and so it is less than the half of 10.5.

If the found value does not pass the control step, the next better maximum have to be checked with the control step. If the second best maximum also does not match the control step, the third best maximum is finally the value which has to be found. The third best maximum must not be proved with the control step.

Habilidades: Cocoa, Engenharia, Mac OS, MySQL, PHP, Arquitetura de software, Teste de Software

Ver mais: use of algorithm, use algorithm, us algorithm, the algorithm is, the algorithm, set algorithm, process x, php on line 87, match 3 algorithm, line algorithm, how to use algorithm, how to do algorithm, how to algorithm, find-s algorithm in c, find maximum algorithm, example of an algorithm, example of algorithm, example of a algorithm, example for algorithm, example algorithm, different algorithm, data algorithm, compare ms project, code 8, c look algorithm

Acerca do Empregador:
( 180 comentários ) London, United Kingdom

ID do Projeto: #3175763

Premiar a:

telios

See private message.

$7 USD em 3 dias
(10 Avaliações)
2.0