# Thread: Trying to calculate non linear count value based on azimuth value

1. ## Trying to calculate non linear count value based on azimuth value

Hi,

Ok so this is my first post so apologies if this is in the wrong place or doesn't even make sense...

I am working with a satellite dish controller which operates and points the dish based on a 'counts' value. The range of counts is 31 - 10819 and the look angle range is 47° East to 47° West. I am trying to calculate the count value for a position in the arc but the controller is non-linear so working out the counts per angle value and multiplying that by the look angle doesn't work.

I'm not sure if it is even possible to do the calculation but I have a few reference points in the arc and their count values if that helps:

47°E = 31 Counts
42°E = 344 Counts
33°E = 1022 Counts
21°E = 2158 Counts
10°E = 3563 Counts
3°E = 4496 Counts
-8°W = 6105 Counts
-18°W = 7554 Counts
-27.5°W = 8802 Counts
-37.5°W = 9877 Counts
-47°W = 10819 Counts

If that makes enough sense for anyone to have any ideas or solutions then any help would be very gratefully received!

Thank you!

Tom

2. ## Re: Trying to calculate non linear count value based on azimuth value

it should be linear enough for this application

3. ## Re: Trying to calculate non linear count value based on azimuth value

Ok, that looks promising... thank you. So what would the calculation be (this is beyond me!)

Thanks,

Tom

4. ## Re: Trying to calculate non linear count value based on azimuth value

Originally Posted by tbow50
Ok, that looks promising... thank you. So what would the calculation be (this is beyond me!)

Thanks,

Tom
it's right there in the sheet where it says FittedModel

5. ## Re: Trying to calculate non linear count value based on azimuth value

sinusoidal regression ...

6. ## Re: Trying to calculate non linear count value based on azimuth value

Ok so I realise that maybe I'm being a bit of a dumb ass here but what I'm after is an equation based on the upper and lower limits so that I can calculate the count value for any angle within the range.

For example I would be able to calculate that to go to 14°E I need to move to x counts, or to go to -23°W I would go to x counts. If someone could give me an example of that then I would be eternally grateful.

Thank you so much for the help so far!

Tom

7. ## Re: Trying to calculate non linear count value based on azimuth value

using the linear model provided by romsek ...

x = angle, y = counts

$y = 5177.17-120.992x$

so, for 14E $\implies$ x = 14 ...

$y = 5177.17-120.992(14) \approx 3483$

using the sinusoidal equation I provided in post #5

$y = 5948.356\sin(.024x - 3.004) + 5768.470$

$y = 5948.356\sin[.024(14) - 3.004] + 5768.470 \approx 3056$

I also performed a cubic regression shown in the attachments ...

$y = 0.013x^3 + 0.218x^2 - 142.091x + 4959.825$

$y = 0.013(14)^3 + 0.218(14)^2 - 142.091(14) + 4959.825 \approx 3049$

if you want the count for -23W, use x = -23 in each model

8. ## Re: Trying to calculate non linear count value based on azimuth value

Cubic splines will give a pretty good result.

You can also use the generalized logistic function. For your data we have the following results.

A=13858.62
K=-1383.02
Q=1.122
B=0.04317
v=1.403
This actually gives a pretty good fit, the mean error is about 17 'counts' which amounts is a small fraction of a degree.

9. ## Re: Trying to calculate non linear count value based on azimuth value

Is there any chance someone could translate the equation(s) into an Excel Spreadsheet for me, I'm still struggling with making the math work for the examples in my original post.

Again, thank you so much for the help!

Tom

10. ## Re: Trying to calculate non linear count value based on azimuth value

Hi Tom,

Any nonlinear problem can be solved in excel using the Generalized Reduced Gradient algorithm as implemented in the 'solver' add on, which is free and already there, but just needs to be activated.

For cubic splines the easiest method is to download a third party add on, there are a few free ones available.

11. ## Re: Trying to calculate non linear count value based on azimuth value

Ok so I have got the sinusoidal regression from post 5 working and pretty accurate so my last (hopefully) question is how were the a, b, c & d values calculated/generate from the original data?

Cheers,

Tom

12. ## Re: Trying to calculate non linear count value based on azimuth value

Originally Posted by tbow50
Ok so I have got the sinusoidal regression from post 5 working and pretty accurate so my last (hopefully) question is how were the a, b, c & d values calculated/generate from the original data?
I performed a sinusoidal regression on my TI-84 calculator ... the screen shot shows its calculation.

13. ## Re: Trying to calculate non linear count value based on azimuth value

Originally Posted by tbow50
Ok so I have got the sinusoidal regression from post 5 working and pretty accurate so my last (hopefully) question is how were the a, b, c & d values calculated/generate from the original data?

Cheers,

Tom
If you want to do it in excel,

make a column (1) for x data (degrees)
make a column (2) for y data (counts)
make a column (3)for estimated y as derived from some arbitrary values for your variables
make a column (4) for squared errors (estimated y - y)^2
make a cell for the sum of squared errors (sum of the elements in (4))

Now open the solver add on and make the target cell the sum of squared errors, set your regression variables as variables in the add on, and set it to minimize the target with no constraint that the variables be positive.

The result will give the local optimum from your initial starting conditions. For sinusoidal regression the local optimum will be a global optima.

14. ## Re: Trying to calculate non linear count value based on azimuth value

Thanks everyone. I am just trying to get this figured out and have a couple more questions...

Skeeter, in post #5 how were the values in the third image generated, -56.4 etc? They are what I am having problems calculating at the moment.

Frustrated, how did you generate the values in your post #8 based on the inital data?

As always, the help is very much appreciated.

Tom

15. ## Re: Trying to calculate non linear count value based on azimuth value

Hi Tom,

Use the instructions in my post above (for nonlinear regression) but use the generalized logistic function: https://en.wikipedia.org/wiki/Genera...istic_function, for the results I gave I set C=1, but you can try letting it be another free variable.

Page 1 of 3 123 Last