Segment between two points in a table with log

Hello, i am using Teensy 3.2 for o a project and i was thinking how to solve this mystery
I want to generate a wavetable of 17 variables or more, but it's enough this row to understand it :slight_smile:

  • The hight values ± 32760 peak to peak
  • p1, p2 will be adjusted with a analog pots (or an encoder)

And here is the mystery :o

  • i want the int segment = analogRead(A3); Analog POT from the code below to connect the variables

p12, p13, p14, p15, p16, p17, p18, p19, p110, p111, p112, p113, p114, p115, p116

  • between points p1 and p2 with a line blending a logaritmic (concave) and 90 ungle at the maximum rotation of the POT, respectively straight line at midle, logaritmic (covexe) below midle and -90 at minimum rotation
int pr1 = analogRead(A1);
int16_t p1 = map(pr1,0, 4095 -32760, 32760);

int pr2 = analogRead(A2);
int16_t p2 = map(pr2,0, 4095 -32760, 32760);

int segment = analogRead(A3); //line between point p1 and p2


int16_t sqrx2[17] = {

    p1, p12, p13, p14, p15, p16, p17, p18, p19, p110, p111, p112, p113, p114, p115, p116
    p2,             
    
  };

ANy sugestions? Thanks in advance

Abandon the thought of using log curves. Go with more table entries and straight-line interpolation for the in-betweens. I use a 91 entry table for my sin/cos curves and get 0.02% accuracy in about one third the time.

int pr1 = analogRead(A1);
int16_t p1 = map(pr1,0, 4095 -32760, 32760);

int pr2 = analogRead(A2);
int16_t p2 = map(pr2,0, 4095 -32760, 32760);

I understand that this will not compile because it is missing a couple of commas.
I understand that the largest int is 32767. 32768 is going to need a long.
I understand nothing of the rest of the text. Sorry.

Yes, this will not compile until all the variables are initiated, this is the issue, how to :slight_smile:
the int is maped for ±32760
Here is a poor schematic of what i mean with an example where p1 is -32768 and p2 is 32768

Anyone?

The curve you are trying to plot is called a Sigmoid function, and by virtue of the S in Sigmoid or the shape of the curve is often simply referred to as an S-curve. The formula is 1/(1+ne^(-x)).

Yes, this will not compile until all the variables are initiated

The problem is the missing commas. Fix that.