Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top