# Spectral density and average frequency

1. Oct 8, 2009

### doop4

Essentailly what I am interested is to solve Equation 10.25 in the following link

ie. solve for the mean angular frequency. Let's call it x' where

x'=integral(x*y(x).dx)/integral(y(x).dx) % Equation 10.25 where y(x) is the spectral density and x is the angular frequency.

I have data for the spectral density values for a given angular frequency

y=[6.2770
10.5137
14.8385
19.2196
21.5972
19.6632
15.2690
10.9238
6.5569]

x=[ 2.6097
2.6158
2.6259
2.6314
2.6501
2.6615
2.6633
2.6654
2.6659]

How can I solve for x' using the above data in Matlab?

My understanding is that the numerator is essentially:

sum[x*y(x)] for the given values of x and y (ie a weighted form ). therefore I have

numerator=x.*y;

the bottom is the integral so i tried using the matlab function trapz(x,y) to calculate that as well.

denominator =trapz(x,y);

therefore x'=numerator/denominator

But the answer I get is incorrect. I am not sure where my mistake is. Any help will be much appreciated!

2. Oct 9, 2009

### Staff: Mentor

Is this schoolwork or work-work? It needs to be posted in different places, depending.

Quiz Question -- Why?

3. Oct 9, 2009

### doop4

It's sort of "home work" of a grad. Any ideas on a solution?