How to get bode transfer function from an idss structure?

Hello, I have an array of idss state space models and i'd like to get the Bode Transfer function: is there a way?
Also, I am using the bode plot matlab function as bodeplot(m) where m an idss structure or an array of idss. I'd like to have the plot in Hz: Ive read that the solution for that is
bode(m,'FrequencyUnits','Hz')
but this is not working in any case. How can I do that? Thanks a lot

回答 (1 件)

Arkadiy Turevskiy
Arkadiy Turevskiy 2014 年 2 月 21 日
編集済み: Arkadiy Turevskiy 2014 年 2 月 21 日

0 投票

You can use function bode to get magnitude and phase of an individual stat space system from the array. If you want an array of magnitudes and phases, you'll need to create a double for loop. Use bodeplot to change frequency to Hz.
% create 7 by 8 array of idss
A = rand(2,2,7,8);
sysarr = idss(A,[2;1],[1 1],0);
w=logspace(-3,1,100);
% draw bode plot h=bodeplot(sysarr);
h=bodeplot(sysarr);
% change frequency to Hz
setoptions(h,'FreqUnits','Hz')
% compute array of magnitudes and phases
arrsize=size(sysarr);
magarr=zeros(length(w),arrsize(3),arrsize(4));
pharr=zeros(length(w),arrsize(3),arrsize(4));
for ii=1:arrsize(3),
for jj=1:arrsize(4),
[mag,ph]=bode(sysarr(:,:,ii,jj),w);
magarr(:,ii,jj)=squeeze(mag);
pharr(:,ii,jj)=squeeze(ph);
end;
end

3 件のコメント

Francesco
Francesco 2014 年 2 月 21 日
編集済み: Francesco 2014 年 2 月 21 日
THanks you have been very helpful and extremely clear. But I get an error when executing
setoptions(h,'FreqUnits','Hz')
??? Undefined function or method 'setptions' for input arguments of type 'double'.
Plus I'd like to extract the poles (and zeros) of the Bode transfer function, is there a way to do that? Actually note that in the code you posted, it is returning an error when assigning 'sysarray'
Arkadiy Turevskiy
Arkadiy Turevskiy 2014 年 2 月 21 日
編集済み: Arkadiy Turevskiy 2014 年 2 月 21 日
what version of MATLAB are you using and what products do you have on your license? Do >>ver to check that.
The code I provided runs fine for me and does not produce any errors.
If you want poles and zeros, you do not need bode plot, you can simply do this:
% check poles for 1,1 array element
pole(sysarr(:,:,1,1))
% check zeros for 1,1 array element
zero(sysarr(:,:,1,1))
Francesco
Francesco 2014 年 2 月 25 日
I have Matlab 2010 for Mac. The System Identification Toolbox is installed but some functions (such as setoptions, getoptions, pole, zero) are missing.

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

カテゴリ

ヘルプ センター および File ExchangeTime and Frequency Domain Analysis についてさらに検索

質問済み:

2014 年 2 月 21 日

コメント済み:

2014 年 2 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by