qsyn / openQsyn

A modern open source toolbox for QFT control synthesis
https://qsyn.github.io/
GNU Lesser General Public License v3.0
7 stars 8 forks source link

bodeplotter improved performance #6

Closed GalBarkai closed 4 years ago

GalBarkai commented 4 years ago

Plotting with matrices greatly enhances performance. The original version looped twice on all the cases while running "hold" in each iteration. Tested on the simple SISO example parameters on my machine performance of the original "P.bodcases()" was 12.209 seconds, with this version run time is down to 3.862 seconds. @rubindan

GalBarkai commented 4 years ago

Added a small change to "nicholsplotter" (see description) which improves run time. @rubindan

rubindan commented 4 years ago

Using bodcases with 'showphase' or 'showmag' option turned off results in error:

>> P.bodcases('showmag',0)
Undefined function or variable 'ha'.

Error in bodeplotter (line 45)
set(ha(1), 'ColorOrder', col, 'NextPlot', 'replacechildren');

Error in qplant/bodcases (line 62)
bodeplotter(res.',w,opt,col,linespec);   % plot the Bode for all cases
GalBarkai commented 4 years ago

Fixed the problem, was referring to handle "ha(i)" even when it didn't exist, switching to simply gca solves this

rubindan commented 4 years ago

bodcases now deletes content of existing figures. It is a problem when used to show response on top of specification. example from example.mlx:

spec2.show('freq'); hold on             % show the specs.
T.bodcases([],w_nom,'showphase',0) 
GalBarkai commented 4 years ago

Fixed the overwrite, it creates a shift of the colors in "col" by 1, which is not a major issue but I'm still thinking about how to solve it