Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
spectral density and average frequency

Subject: spectral density and average frequency

From: M K

Date: 8 Oct, 2009 23:37:02

Message: 1 of 2

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

<http://books.google.co.uk/books?id=Hwb5D60vb5IC&pg=PA701&lpg=PA701&dq=%22mean+angular+frequency%22&source=bl&ots=dSH6fzeZNC&sig=GB5J8nwpLCIULGhAHZLAm0RxgLM&hl=en&ei=NubNSpKqO92NjAeqwKmHBA&sa=X&oi=book_result&ct=result&resnum=9#v=onepage&q=%22mean%20angular%20frequency%22&f=false>

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!

Subject: spectral density and average frequency

From: Daniel Armyr

Date: 15 Oct, 2009 11:10:17

Message: 2 of 2

> 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.

> 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);
>

You are essentially there, but not quite. Good work so far.
This is the formula you provide: x'=integral(x*y(x).dx)/integral(y(x).dx)
Then you need to convert it to Matlab, and you got the first part right:
integral(x*y) = sum(x.*y)

The second part is just as easy:
integral(y) = sum(y).

Therefore, your mean frequency (x) is simply:
meanX = sum(x.*y)/sum(y)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us