Defining points with unequal intervals in C

JasKa071 Source

I have the following for loop in c:

for (j=0; j<=NOUT; j++)
            t[j] = -1.4 + 2.8*(double)j/100; 

which creates a hundred points equally spaced between -1.4 and 2.8.

However, I was wondering if it is possible to create a loop which concentrates the number of points at a certain position, for example at 1 (or any given value between -1.4 and 2.8).

So the distance t[j-1] - t[j] gets smaller as t[j] approaches 1 and gets bigger as t[j] heads away from 1. Thus there is a higher concentration of points near t[j]=1 for a given neighbourhood.

I not even too sure how one might attempt this task and any help is greatly appreciated.



comments powered by Disqus