Code covered by the BSD License  

Highlights from
LqrSim

4.1

4.1 | 10 ratings Rate this file 23 Downloads (last 30 days) File Size: 172.9 KB File ID: #2651
image thumbnail

LqrSim

by Giampiero Campa

 

06 Nov 2002 (Updated 20 Jul 2009)

Algebraic Riccati Equation solution in Simulink via C+Fortran

| Watch this File

File Information
Description

This s-function solves Riccati equations in Simulink without calling the Matlab interpreter, it is FAST and usable with Real Time Workshop.

Specifically, the s-function is a level-2 gateway that calls several FORTRAN routines written by Arnold and Laub in the early eighties and publicly available under the cascade sublibrary of netlib. FORTRAN code is included in the Readme file, along with further instructions on how to compile and link the s-function.

Giampiero Campa, October 2002 and January 2009
Riccardo Bevilacqua & Jason Hall, NPS Spacecraft Robotics Lab, October 2008

Required Products Simulink
MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (11)
04 Feb 2003 Paul Nune

Hi. I´m Paul from Portugal.
I´ve no words to describe your excelent work.

Thank you Mr. Giampiero Campa

13 Nov 2005 samu abdu

it is very useful for non mathematicians doing research in control theory.........

16 Oct 2006 Wojtek S

Thank You Mr. Giampiero Campa . It works perfectly and saves time.

02 Feb 2007 xiaoming wang

ich grade brauche ihn, danke!!!

05 May 2007 javad heydari  
23 Jul 2007 Cristian Gutiérrez

sorry, but it needs improvement.

04 Apr 2008 Majdi Belguith

How could I add this application to Matlab
thanks

16 May 2008 Martins _

Works very well on Matlab 2007b or older, but does not work on 2008.

05 Jun 2008 Jason Hall

Very good in Matlab 2007b. As you code, obviously keep in mind that Q needs to be a real symmetric positive semi-definite matrix and R needs to be a real symmetric positive definite matrix. Furthermore, if R is ill-conditioned, this block will not compute the gain properly. Conversely, Matlab's LQRY function can still compute the gain matrix even with an ill-conditioned R matrix. Very good block though.

08 Nov 2010 Jiang Wang  
08 Nov 2010 Jiang Wang

Hello Dr. Campa,

Thanks for your excellent work. I have one question: does this subroutine support solving discrete algebraic riccati equations? The Matlab command LQRY can do this for discrete system, but after I check your code, it seems that it doesn't have this option for discrete time system. Thanks.

Please login to add a comment or rating.
Updates
30 Jan 2003

The fortran subfunctions have been
compiled using the multithreaded library
(DFORMT.LIB) and some optimization options.
As a result the DLL is smaller and runs faster.

04 Apr 2003

Instructions on how to compile with The Real Time Workshop have been added.

02 Jun 2003

The file info.xml has been updated.

12 May 2005

Renamed everything lowercase

03 Jan 2006

Move it to simulink utilities.

07 Feb 2007

Changed info.xml file to avoid annoying messages within the last matlab versions.

23 Oct 2007

Recompiled mex files with matlab 7.1 so that everything works fine with newer versions requiring the .mexw32 extension. The .dll files are retained to the benefit users working with versions prior to 7.1, other users may delete them.

02 Jan 2009

This version works with MATLAB 7.6 (R2008a), uses native matrix signals, is re-mexable on every platform, and is better integrated with real time workshop (Thanks Jason & Riccardo).

06 Jan 2009

Many thanks to Jason Hall and Riccardo Bevilacqua for your excellent job in enabling native matrices inputs to the block and
using the open source g77 FORTRAN compiler to create mex files and RTW binaries under both Windows and Linux.

20 Jul 2009

Fully converted to BSD License

Tag Activity for this File
Tag Applied By Date/Time
simulink Giampiero Campa 22 Oct 2008 06:53:28
riccati Giampiero Campa 22 Oct 2008 06:53:28
are Giampiero Campa 22 Oct 2008 06:53:28
lqr Giampiero Campa 22 Oct 2008 06:53:28
lqe Giampiero Campa 22 Oct 2008 06:53:28
lqg Giampiero Campa 22 Oct 2008 06:53:28
adaptive Giampiero Campa 22 Oct 2008 06:53:28
optimal Giampiero Campa 22 Oct 2008 06:53:28
control Giampiero Campa 22 Oct 2008 06:53:28
fortran Giampiero Campa 22 Oct 2008 06:53:28

Contact us at files@mathworks.com