Calculating the (real) peak value of a set of points

Status
Not open for further replies.

edaudio2000

Newbie level 4
Joined
Oct 20, 2006
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,316
I have a stored discrete time series H(i). Typical values are: (descriptive only, the actual values are float):

H= 0,0,0,0,4,7,12,15,13,9,6,4,1,0,0,0,0,0,0,0

This corresponds to sampled ponts of a smooth waveform H(t) which has a generic raised cosine form. Amplitudes vary, but only the position of the maximum needs to be computed. The maximum will, in the main, lie somewhere between two of the H sampled points, it is this relative position I need to work out.

ANy thoughts?

TIA
 

use an interpolator and find the peak

Matlab has functions for this.
 

brmadhukar said:
use an interpolator and find the peak

Matlab has functions for this.

Sorry, I should have added that I want to write this as a function to an existing C program.
 

I write this simple routine for you.

#include<stdio.h>
#include<conio.h>

void main(void)
{
float Hi[20],Max;
int i,Pos;

for(i=0;i<20;i++)
{
printf("Hi[%d] = ", i);
scanf("%f", &Hi);
printf("\n");
}
printf("Inputs are Complete.\n");
printf("\n");

Max = Hi[0];
for(i=0;i<20;i++)
{
if (Hi>Max)
{
Max = Hi;
Pos = i;
}
}
Pos+=1;
printf("Max(Hi) = %f\n", Max);
printf("Positin = %i\n", Pos);
getch();
}

Output:
15.0000
8

Hamid Reza.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…