Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Trying to use invfreqs

385 views
Skip to first unread message

Madhu Shurpali

unread,
Feb 18, 2010, 12:53:07 AM2/18/10
to
hello,

I am trying to use invfreqs to get the transferfunction from frequency response data.

I have the frequency response measured at 0.5 Hz, 1Hz, 2HZ, 4Hz and 6Hz. I used a 3rd order for the numerator and 4th order for the denominator. The complex frequency reponse is as follows:
30.56 + i 3.143
33.75 + i 1.916
34.36 + i 1.860
33.69 + i 6.308
35.86 + i 5.768

When I used invfreqs, I got the following transfer function.
Numerator =
1.0e+007 *
-0.0014 -0.0177 -0.7040 -1.9653
Denominator =
1.0e+005 *
0.0000 -0.0038 -0.0504 -1.9995 -6.7095


Looking at the Numerator and Denominator, i feel there is something wrong.
Now when I plot the reposnse using the transfer function, there is not a good match between the desired response and the actual response.

Please suggest if I am doing anything wrong while obtaining the transfer function.

Thanks
Madhu

Rajiv Singh

unread,
Feb 19, 2010, 3:12:12 PM2/19/10
to
A more effective way might be to use parametric modeling tools in System
Identification Toolbox. Your task is an exercise in "frequency domain
identification". Represent the frequency response as an IDFRD object (it
packages frequency and response values). Then use estimation commands such
as N4SID and OE to estimate state-space or transfer function form of a
parametric model. Use BODE to plot frequency response data and model
response together; use COMPARE command to check how well the model fits the
data. You may find the following demo useful:
http://www.mathworks.com/products/sysid/demos.html?file=/products/demos/shipping/ident/iddemofr.html

Rajiv


"Madhu Shurpali" <madhu.s...@cvgrp.com> wrote in message
news:hlikk3$l6a$1...@fred.mathworks.com...

Wayne King

unread,
Feb 19, 2010, 3:55:21 PM2/19/10
to
"Madhu Shurpali" <madhu.s...@cvgrp.com> wrote in message <hlikk3$l6a$1...@fred.mathworks.com>...
Hi Madhu, In addition to Rajiv's fine advice (System Identification Toolbox has a lot of nice tools), can you please give us your sampling frequency? Without your sampling frequency, nobody can get the right normalized frequencies to try and help you.
Wayne

Madhu Shurpali

unread,
Feb 22, 2010, 6:19:03 AM2/22/10
to
> Hi Madhu, In addition to Rajiv's fine advice (System Identification Toolbox has a lot of nice tools), can you please give us your sampling frequency? Without your sampling frequency, nobody can get the right normalized frequencies to try and help you.
> Wayne

Wayne and Rajiv thanks a lot for the advice.

Wayne: I think the Sampling freq doesnt come into picutre here. The way I got my Complex Freq response is as follows:

I input a displacement of 0.5 Hz freq and 5 mm amplitude sine wave into my specimen and measured the force as the output. Now my specimen has some damping in it so when I plot Disp Vs Force I get a elliptical hysteresis curve. From the Hysteresis curve I get the stiffness and damping. I did this at Freqs of 0.5 Hz, 1Hz, 2HZ, 4Hz and 6Hz keeping the amplitude constant. Thus I got the stiffness and damping at each Freq. From the stiffness and damping at each freq I came up with the Complex Freq response.

Also since I am trying to get the transfer function in the s domain, freq normalisation will not be done.

Thanks for all the help

Madhu Shurpali

unread,
Feb 22, 2010, 7:28:02 AM2/22/10
to
While trying to use IDFRD and OE, I came up with the following script:

freq = [0.314159 3.141592654, 6.283185307, 12.56637061, 25.13274123, 37.69911184];
Real = [31.93 32.914 34.25 34.6 33.18 36.57 ];
Img = [3.446 2.941 1.828 1.646 7.213 7.955];

Response = complex(Real, Img);

Respone_model = idfrd(Response, freq, 0);

Tf_model = oe(Respone_model, [3 4]);

With this my Tranfer function model predicted was as follows:

>> Tf_model.b
ans =
1.0e+008 *
0.0023 -0.0253 1.2619
>> Tf_model.f
ans =
1.0e+006 *
0.0000 -0.0000 0.0081 -0.0945 3.8178

These values I feel are very large and I think I doing something wrong.. Can you please comment on the script and the Trasnfer function that 'OE' has predicted.

P.S: I am trying to get the continuous time transfer function model.

Thanks
Madhu

Wayne King

unread,
Feb 22, 2010, 8:17:23 AM2/22/10
to
"Madhu Shurpali" <madhu.s...@cvgrp.com> wrote in message <hltp77$nrj$1...@fred.mathworks.com>...

Sorry Madhu, I read invfreqz instead of infreqs, my mistake. Do you obtain the transfer function based on

freq = [0.314159 3.141592654, 6.283185307, 12.56637061, 25.13274123, 37.69911184];
Real = [31.93 32.914 34.25 34.6 33.18 36.57 ];

Imag = [3.446 2.941 1.828 1.646 7.213 7.955];
h = Real+1j*Imag;
[b,a]= invfreqs(h,freq,3,4);
sys = tf(b,a);
% yields
Transfer function:
-1.065e004 s^3 - 1.564e005 s^2 - 6.269e006 s - 7.586e006
--------------------------------------------------------
s^4 - 264.7 s^3 - 4039 s^2 - 1.768e005 s - 2.558e005


Can you say what doesn't seem right about it? You say looking at it, it doesn't seem right.

Sorry again about misreading your post.
Wayne

Madhu Shurpali

unread,
Feb 22, 2010, 8:27:22 AM2/22/10
to
> Sorry Madhu, I read invfreqz instead of infreqs, my mistake. Do you obtain the transfer function based on
>
> freq = [0.314159 3.141592654, 6.283185307, 12.56637061, 25.13274123, 37.69911184];
> Real = [31.93 32.914 34.25 34.6 33.18 36.57 ];
> Imag = [3.446 2.941 1.828 1.646 7.213 7.955];
> h = Real+1j*Imag;
> [b,a]= invfreqs(h,freq,3,4);
> sys = tf(b,a);
> % yields
> Transfer function:
> -1.065e004 s^3 - 1.564e005 s^2 - 6.269e006 s - 7.586e006
> --------------------------------------------------------
> s^4 - 264.7 s^3 - 4039 s^2 - 1.768e005 s - 2.558e005
>
>
> Can you say what doesn't seem right about it? You say looking at it, it doesn't seem right.
>
> Sorry again about misreading your post.
> Wayne

Ok, heres what I did: To check my model in time domain, I built a simple simulink model consisting of the following:
A sinewave input block, a transfer function block and a scope block. Output of sinewave goes into tansfer function block and output of transfer function goes into scope. I define the transfer function as per the coefficients I got from the invfreqs function. For solving I used a variable step, ode45 solver with other parameters at the default value.

Now when I simulate, with a 10mm, 5Hz sinewave I get unrealistically high values. I expect a sinewave with a gain of about 34. I am able to understand this phenomena.

Thanks for the help.

Madhu

Madhu Shurpali

unread,
Feb 22, 2010, 9:03:02 AM2/22/10
to
Sorry for the typo in the previous post. It shoul dbe like the following:

"I am unable to understand the phenomena"

Madhu Shurpali

unread,
Feb 23, 2010, 6:40:07 AM2/23/10
to
"Madhu Shurpali" <madhu.s...@cvgrp.com> wrote in message <hlu2qm$3ve$1...@fred.mathworks.com>...

> Sorry for the typo in the previous post. It shoul dbe like the following:
>
> "I am unable to understand the phenomena"

Somebody please help.. I am not able to go forward from here.

Oskar Vivero

unread,
Feb 23, 2010, 11:06:06 AM2/23/10
to
"Madhu Shurpali" <madhu.s...@cvgrp.com> wrote in message <hm0qds$ea5$1...@fred.mathworks.com>...
> Another observation:
> When I specified an order of 4 for both the numerator and denominator, I observed that initially the respose was good. But as the simulation time increased, the response kept on diverging - increasing in magnitude.
>
> So if my simulation time is 10 sec and I input a sinewave of 5 Hz. Initially I get a gain of about 34 which is expected but after about 5 secs the response starts diverging and the gain is about 100-200. And it keeps on increasing..
>
> Can somebody suggest as to what might be going wrong.
>
> Thanks
> Madhu

Model order selection is a real problem in the scientific community at this point. There are several criterions you can use (such as Akaike's Information Criterion) but it is still complicated.

The divergence you see is because (assuming you are obtaining a denominator similar to the one in your previous post) you have a positive real pole, i.e. your plant is unstable. So again, start with smaller orders and work your way up until you find the best possible fit.

Oskar Vivero

unread,
Feb 23, 2010, 8:53:04 AM2/23/10
to
"Madhu Shurpali" <madhu.s...@cvgrp.com> wrote in message <hm0eqn$kp1$1...@fred.mathworks.com>...

While using the system identification toolbox is good advice, there are some things you need to check before that, for example:

1) Noise levels, if big your estimates will be biased and hence your response won't look alike to your physical plant.
2) Why are you picking such model orders in the first place. If you over or under specify your transfer function structure your estimates will also be wrong. In the same vein, and if the noise levels are small there is no reason why invfreq shouldn't work unless your model structure is incorrect.

I hope this helps

Madhu Shurpali

unread,
Feb 23, 2010, 9:23:05 AM2/23/10
to
"Oskar Vivero" <oskar.viv...@gmail.com> wrote in message <hm0mk0$8bv$1...@fred.mathworks.com>...

Thanks a lot for the help. My results were much better when I specified both the Numeraor and Denominator of order 4.

Now this brings me to the question, how do we select a proper model or order for the model. Is there any reference that I can look into to get this information.

Thanks
Madhu

Madhu Shurpali

unread,
Feb 23, 2010, 9:58:04 AM2/23/10
to
0 new messages