How to get bode transfer function from an idss structure?
    2 views (last 30 days)
  
       Show older comments
    
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
0 Comments
Answers (1)
  Arkadiy Turevskiy
    
 on 21 Feb 2014
        
      Edited: Arkadiy Turevskiy
    
 on 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 Comments
  Arkadiy Turevskiy
    
 on 21 Feb 2014
				
      Edited: Arkadiy Turevskiy
    
 on 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))
See Also
Categories
				Find more on Time and Frequency Domain Analysis in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
