How to get bode transfer function from an idss structure?

2 次查看(过去 30 天)
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
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 个评论
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Uncertainty Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by