Turning on grid on ltiviewer

14 ビュー (過去 30 日間)
James
James 2011 年 3 月 30 日
Hi everyone,
I displayed 2 systems using ltiview as shown below:
load ltiexamples ltiview({'step';'bode';'impulse';'nichols'},Gcl2,Gcl1)
I'm wondering how do we turn on the grid on these plots using MATLAB commands? (i.e without going to 'viewer preferences>style')
Thanks in advance guys.

回答 (5 件)

Paulo Silva
Paulo Silva 2011 年 3 月 30 日
%brute force way, it turns on the grids for all axes
ha=findobj('type','axes')
arrayfun(@(x)set(x,'XGrid','on'),ha)
arrayfun(@(x)set(x,'YGrid','on'),ha)
  1 件のコメント
James
James 2011 年 3 月 30 日
Hi,
Thanks for your reply.
However, the grid for Nichols plot doesn't look correct, as is, not the same as that displayed when I right click on the plot and select grid.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2011 年 3 月 30 日
After the ltiview() call,
grid on
  2 件のコメント
Paulo Silva
Paulo Silva 2011 年 3 月 30 日
grid on only applies to the current axes
Walter Roberson
Walter Roberson 2011 年 3 月 30 日
Ah, it appears ltiview opens a new figure and doesn't return the figure number either. If you findobj('type','figure') then you should be able to locate the figure number; from there you should be able to examine the properties of that figure to see if, for example, it has a particular Tag or Name, or if its children have distinctive properties.
Sorry, I do not have one of the applicable toolboxes so I cannot experiment with this.

サインインしてコメントする。


James
James 2011 年 3 月 30 日
Hi guys,
I found a way but still not the best. The grid for Bode diagram is not displayed. Here's what I did;
obj = findobj('Type','axes'); for i = 1:length(obj) grid(obj(i)) end
Any workaround on this?
Thanks.

James
James 2011 年 3 月 30 日
ooooppppss!!! How do I undo accepted answers?
  2 件のコメント
Matt Fig
Matt Fig 2011 年 3 月 30 日
You cannot. If you want this done, you can try here:
files@mathworks.com
James
James 2011 年 3 月 30 日
Thanks.

サインインしてコメントする。


James
James 2011 年 3 月 30 日
Got it. Need to add 'on' after grid. For bode diagram the command 'grid' is executed twice. Hence, it's turned off.
obj = findobj('Type','axes');
for i =1:length(obj)
grid(obj(i),'on')
end

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by