Measure Frequency and then scaling it

How to measure the frequency of a signal (which varies) and then scaling it to a certain value.
and what device can i use to simulate this? constant dc with a varying frequency.

can i do this to measure the frequency?

duration = pulseIn(pin, HIGH);
int out[]={10,20,30,40,50,60,70,80,90,100};
int in[]={12.5,16.67,25,27.78,31.72,35.71,41.67,50,55.56,62.5};
speed = multiMap(duration,in,out,10);

What frequency (in Hz, kHz or MHz), what signal voltage, and what is "constant dc with a varying frequency"?

only in Hz

Please read and follow the directions in the "How to use this forum" post.

Please note that 12.5 and 16.67 are not integer values. You will either need to scale the values (16.67 -> 1667, 12.5->1250), or use floating-point values, or truncate your values to integers.

The pulseIn() function gives you an integer duration in microseconds. It only measures one portion of the frequency cycle (HIGH or LOW). For a frequency that is not changing you can get a good approximation of the frequency by measuring portions of two separate cycles:

unsigned long duration = pulseIn(pin, HIGH) + pulseIn(pin, LOW);
unsigned long frequency = 1000000UL / duration;  // integer cycles per second

If you want precision better than 1 Hz you can use 10 or 100 seconds:

unsigned long frequency = 100000000UL / duration;  // integer cycles per 100 seconds

Then you can use multiMap() to map the frequency to different values.