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:
Parameter optimization

Subject: Parameter optimization

From: Zaid

Date: 22 Dec, 2009 04:51:02

Message: 1 of 9

Hi there,

I have some measurements data that depicts the Bode plot. I'm particularly interested on the phase part.

From the plot, it has lagging characteristics between 0.2 to 2 Hz.
I have 2 lead-lag blocks. By adding the two blocks, I will need the resultant phase plot to be near zero degrees. If possible, I would like Matlab to optimize the 2 blocks

Is there anywhere in Matlab/ simulink where I can automate/ derive the 2 lead-lag parameters? if yes, could you guys help identify which part should i use? or better if there is a tutorial somewhere.

Looking forward to your response.
Thank you.

Subject: Parameter optimization

From: Zaid

Date: 30 Dec, 2009 07:26:04

Message: 2 of 9

Anyone?
Hope the guys from Mathworks can help out...
tq.

Subject: Parameter optimization

From: Arkadiy Turevskiy

Date: 30 Dec, 2009 19:36:04

Message: 3 of 9

Hi Zaid,
There is a tool called Simulink Design Optimization. With this tool you can specify what gain/phase margins you want your system to have and it will optimize controller parameters to achieve the desired performance using numerical optimization.

You can see the demo here:
http://www.mathworks.com/products/sl-design-optimization/demos.html?file=/products/demos/shipping/sldo/speedctrl_demopad.html

In frequency domain the requirements you can specify are: phase and gain margin, and lower and upper gain limits. So you can't specify the limits on phase curve as you are asking.

You will have to either specify phase margin, or tune manually.

Hope this helps.
Arkadiy


"Zaid " <zaid81@gmail.com> wrote in message <hgpj7m$ogm$1@fred.mathworks.com>...
> Hi there,
>
> I have some measurements data that depicts the Bode plot. I'm particularly interested on the phase part.
>
> From the plot, it has lagging characteristics between 0.2 to 2 Hz.
> I have 2 lead-lag blocks. By adding the two blocks, I will need the resultant phase plot to be near zero degrees. If possible, I would like Matlab to optimize the 2 blocks
>
> Is there anywhere in Matlab/ simulink where I can automate/ derive the 2 lead-lag parameters? if yes, could you guys help identify which part should i use? or better if there is a tutorial somewhere.
>
> Looking forward to your response.
> Thank you.

Subject: Parameter optimization

From: Zaid

Date: 6 Jan, 2010 07:08:02

Message: 4 of 9

Arkadiy,

Thank you for the response. Really appreciate that.
I've tried looking into Simulink Design Optimization as u propose.

But I have one problem. As mentioned before, I have measurements data depicting the phase bode plot i.e there are only two columns of data, the frequency column and the phase column. How do i translate this is into transfer function form? I tried the System Identification tool, but to no avail. Basically, I created two variables in the Workspace. Then, using System Identification tool, I could not create the data because it needs an input variable. The thing is, I have no data on the input.

The idea is to get a transfer function, where by it'll be easier to model in Simulink block.

Hope this explains well enough.
Looking forward to your reply. TQ.

Subject: Parameter optimization

From: Arkadiy Turevskiy

Date: 6 Jan, 2010 17:00:21

Message: 5 of 9

Hi Zaid,
There are at least 2 options:

1) You can use you frequency response data (magnitude and phase as functions of frequency) to create an frd object.
Here is how you can do it:
http://www.mathworks.com/access/helpdesk/help/toolbox/control/ref/frd.html

Now you can work with this frd object in SISO tool to manually shape the loop response to achieve desired gain and phase margin or use Simulink Design Optimization to do it automatically.
Here is a demo showing how to design a controller for an frd plant model:
http://www.mathworks.com/products/control/demos.html?file=/products/demos/shipping/control/FRDPlantdemo.html

When you work with frd object in SISO Tool, some plots are not going to be available, (such as step response of closed loop system) - as you would expect. So you would shape loop response in frequency domain.

2) You can use System Identification Toolbox with frequency domain data to identify an LTI model. For example you can use the function "pem" to create an lti model and use frd object as an argument.
See this page:
http://www.mathworks.com/access/helpdesk/help/toolbox/ident/ref/pem.html

When you get the lti object, use SISO Tool and now you will be able to use both frequency-domain and time-domain design and analysis plots.

Arkadiy

"Zaid " <zaid81@gmail.com> wrote in message <hi1csi$rhb$1@fred.mathworks.com>...
> Arkadiy,
>
> Thank you for the response. Really appreciate that.
> I've tried looking into Simulink Design Optimization as u propose.
>
> But I have one problem. As mentioned before, I have measurements data depicting the phase bode plot i.e there are only two columns of data, the frequency column and the phase column. How do i translate this is into transfer function form? I tried the System Identification tool, but to no avail. Basically, I created two variables in the Workspace. Then, using System Identification tool, I could not create the data because it needs an input variable. The thing is, I have no data on the input.
>
> The idea is to get a transfer function, where by it'll be easier to model in Simulink block.
>
> Hope this explains well enough.
> Looking forward to your reply. TQ.

Subject: Parameter optimization

From: Zaid

Date: 29 Jan, 2010 01:54:03

Message: 6 of 9

Arkadiy,

I've been swamped with other stuffs.
Anyways, I tried to create an frd object using the example.
But, I got this error message:

>> sisotool({'bode','nichols'},sys)
??? Error using ==> sisodata.loopdata.checkdata>LocalCheckModelData at 77
The G must be a TF, ZPK, or SS model, or a scalar.

What is wrong with my process?
Basically what i did was to convert manually the db and phase data into a complex number in Excel. Then I created two variables in the Matlab workspace, one for the frequencies and the other contains the complex number.

>> sys=frd(resp,freq)
 
  Frequency(rad/s) Response
  ---------------- --------
       0.2045 -0.7290 + 0.7080i
       0.2603 -1.5629 + 1.9634i
       0.3313 -2.2002 + 3.4632i

Hope u don't mind helping.
Looking forward to your reply. TQ.

Subject: Parameter optimization

From: Arkadiy Turevskiy

Date: 29 Jan, 2010 16:45:25

Message: 7 of 9

Hi Zaid,
Most probably you have MATLAB version older that R2009b. The ability to use frd plants in SISO Tool was added in R2009b and is not supported in earlier versions.

You can check what version you have by typing
>>ver

To get the capability to use SISO Tool on your frd object you will need to update to version R2009b.

Arkadiy

"Zaid " <zaid81@gmail.com> wrote in message <hjtf3r$hca$1@fred.mathworks.com>...
> Arkadiy,
>
> I've been swamped with other stuffs.
> Anyways, I tried to create an frd object using the example.
> But, I got this error message:
>
> >> sisotool({'bode','nichols'},sys)
> ??? Error using ==> sisodata.loopdata.checkdata>LocalCheckModelData at 77
> The G must be a TF, ZPK, or SS model, or a scalar.
>
> What is wrong with my process?
> Basically what i did was to convert manually the db and phase data into a complex number in Excel. Then I created two variables in the Matlab workspace, one for the frequencies and the other contains the complex number.
>
> >> sys=frd(resp,freq)
>
> Frequency(rad/s) Response
> ---------------- --------
> 0.2045 -0.7290 + 0.7080i
> 0.2603 -1.5629 + 1.9634i
> 0.3313 -2.2002 + 3.4632i
>
> Hope u don't mind helping.
> Looking forward to your reply. TQ.

Subject: Parameter optimization

From: Zaid

Date: 30 Jan, 2010 07:06:05

Message: 8 of 9

Hi Arkadiy,

It's true I have an older version. R2007a, to be exact.
So, is there any other ways that I can go about, other than the obvious upgrading?
TQ.

Subject: Parameter optimization

From: Arkadiy Turevskiy

Date: 30 Jan, 2010 16:22:06

Message: 9 of 9

Hi Zaid,
You won't be able to use SISO Tool but you can still frequency domain design plots, bode, for example. So basically you'll need to create the transfer function for your compensator, convert it to frd, and then multiply it by plant transfer function. Then you can look at bode plot of open loop transfre function. You can shape it by changing locations of poles and zeros in your compensator. So the process is more manual, and you'll have to do more scirpting, but you can still shape the loop in frequency domain.
Arkadiy

"Zaid " <zaid81@gmail.com> wrote in message <hk0lot$p2l$1@fred.mathworks.com>...
> Hi Arkadiy,
>
> It's true I have an older version. R2007a, to be exact.
> So, is there any other ways that I can go about, other than the obvious upgrading?
> TQ.

Tags for 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