Azzera filtri
Azzera filtri

How to get bode transfer function from an idss structure?

2 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Arkadiy Turevskiy
Arkadiy Turevskiy il 21 Feb 2014
Modificato: Arkadiy Turevskiy il 21 Feb 2014
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 Commenti
Arkadiy Turevskiy
Arkadiy Turevskiy il 21 Feb 2014
Modificato: Arkadiy Turevskiy il 21 Feb 2014
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 il 25 Feb 2014
I have Matlab 2010 for Mac. The System Identification Toolbox is installed but some functions (such as setoptions, getoptions, pole, zero) are missing.

Accedi per commentare.

Categorie

Scopri di più su Get Started with Control System Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by