How to get bode transfer function from an idss structure?
1 次查看(过去 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
0 个评论
回答(1 个)
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
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))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Control System Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!