Code covered by the BSD License  

Highlights from
LqrSim

4.1

4.1 | 10 ratings Rate this file 16 Downloads (last 30 days) File Size: 173 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
adaptive, are, control, fortran, lqe, lqg, lqr, optimal, riccati, simulink
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (15)
05 Oct 2012 Aidin Foroughi

I can't seem to mex it in Matlab 2010. It fails when linking ... some unresolved symbols in scaleg.o

Unfortunately some other code that I have only works on 2010 ..

14 Aug 2012 Jochen Schuettler

Hello again,
contact author is not working, yet. They know about it.

Concerning my problem: I have to compile it first, yes? G77 isn't part of minGW, but GFortran is. It compiles your *.f-files without comment or error, but the mex command cannot use the *.o-files. Matlab is r2007b. Error message is

File ... unknown section /4.

Please help.

14 Aug 2012 Jochen Schuettler

Matlab is r2007b

13 Aug 2012 Jochen Schuettler

Hello Mr. Campa,

sorry about any inconvenience: "Contact Author" is not working, somehow.

I tried using your lqrsim with realtimeworkshop, added the source-directory like explained in the readme-file but still got the following error when compiling:

COMPILING "d:\PROGRA~1\MATLAB\R2007b\rtw\c\src\rt_sim.c"
OPUS MAKE: Don't know how to make 'sfun_lqrysim.o03'. Stop.

Do I have to download the g77 compiler, as you explained for mex-files?

Please help me!

Best regards,
Jochen Schüttler

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.

08 Nov 2010 Jiang Wang  
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.

16 May 2008 Martins _

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

04 Apr 2008 Majdi Belguith

How could I add this application to Matlab
thanks

23 Jul 2007 Cristian Gutiérrez

sorry, but it needs improvement.

05 May 2007 javad heydari  
02 Feb 2007 xiaoming wang

ich grade brauche ihn, danke!!!

16 Oct 2006 Wojtek S

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

13 Nov 2005 samu abdu

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

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

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

Contact us