Asked by John
on 4 Oct 2012

Hi there,

If I have an nx1 vector u plotted against time, I was wondering if there is a way to determine the maximum frequency and if possible, the period of time over which this frequency occurs. I'm fairly certain that the sample frequency for the vector u is much higher than the frequency I'm looking for.

I've attached some images of the u plotted against time in what appears to be in order of decreasing frequency.

If it helps at all, u is a control signal that's a function of several control parameters and the dynamics of the system that I'm trying to control. What I'm trying to do is reduce the tracking error of my system without the frequency of the controlled input, the vector u, going above a set frequency. I can reduce the tracking error by setting my control parameters arbitrarily high or low but the problem is that this comes with the drawback very high controller activity.

So basically what I'm asking is for a given 1D vector u, obtained over a 1D vector of sample times t, how do I determine (or estimate) the maximum frequency of the vector u. Also, if it does go above a given frequency, is there a way to determine how many times it does or over which time intervals it occurs? Can I also determine the local amplitudes at these times?

*No products are associated with this question.*

Answer by Terry
on 4 Oct 2012

This signal looks artificial. Is it a test signal you created?

You are asking several very different question. 1) How to determin the highest frequency in a signal. Real world signal contain noise and will be the highest frequency component. I assume you mean highest significant frequency related to the signal. For an offline result nun an FFT.

< Can I also determine the local amplitudes at these times?> Yes

John
on 5 Oct 2012

Hi Terry, thanks for your response. That signal was not acquired with any kind of data acquisition so I don't think it's noise. I'm simply running a simulation. It represents the solution of one variable, u, of a nonlinear dynamic system of differential equations over a specified amount of time.

Regardless of its physical meaning and how I obtained the vector u, it is just a 1D vector plotted against time and I would just like to know if there is a way to determine how quickly it is fluctuating(?), or the highest frequency. Basically, I want a smooth control signal, not one that's jumping up and down rapidly. I can manually tweak my parameters to get it as smooth as the 4th image, but really I'd like some kind of measureable value that I could set as a state variable so I could constrain the frequency if I wanted to perform an optimization. Thanks again.

John
on 5 Oct 2012

Sorry. I realized you suggested using an FFT. This is what I've tried:

`X1 = abs(fft(u)));`

`X1 = fftshift(X1);`

`F1 = (-num/2:num/2)/num;`

`plot(F1,X1)`

Where 1/num is my sample frequency so size(u)=num+1. This is the result I get:

I'm not sure how to interpret these results of even if I'm using fft correctly. I've read some articles trying to figure this out but I'm not familiar with this branch of mathematics. I'm sorry if things might have to be dumbed down for me but I'm just looking for a simple set of steps to take. This little thing is holding me up quite a bit. I realize that there's a certain level of proficiency that's expected when asking questions but the fact is that I've never come across something like this before. Once again I apologize and any further assistance would be greatly appreciated.

Related Content

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

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments