Created
November 23, 2018 13:04
-
-
Save mnemocron/4d81a4742192d1af3a98f10fa3ea5356 to your computer and use it in GitHub Desktop.
Animation to display the poles of a transfer function in dependence of the parameter qp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%****************************************************************************** | |
% \details : Animation to display the poles of a transfer function in | |
% dependence of the parameter qp | |
% \autor : Simon Burkhardt | |
% \file : siv_animation_of_poles.m | |
% \date : 23.11.2018 | |
% \version : 1.0 | |
%****************************************************************************** | |
clear all; close all; clc; | |
format shorteng; | |
% s-plane (sigma + j*w) | |
sig = -100:0.5:100; | |
jw = -100:0.5:100; | |
[SIG, JW] = meshgrid(sig, jw); | |
% initial values to draw the figure | |
wp = 50; % fixed so that the radius is half the axis limits (100) | |
qp = 1; | |
s = SIG+JW.*j; % s-Matrix | |
% function | |
T = abs((wp.*s)./((s.^2) + (wp.*s./qp) + (wp.^2))); | |
Tmax = 10; | |
fig = surf(SIG,JW,T,'EdgeColor','none','LineStyle','none'); | |
axis([-100 100 -100 100 0 Tmax]); % keep the z-axis steady | |
xlabel sigma | |
ylabel jw | |
zlabel '|T_{(jw)}|' | |
view(20, 60); | |
% add a plane to the jw-axis | |
jwx = -100:10:100; | |
jwy = 0:10:10; | |
[Jx Jy] = meshgrid(jwx, jwy); | |
Jz = (Jx.*Jy.*0); % zeroes | |
hold on | |
axisfig = surf(Jz, Jx, Jy,'EdgeColor','red'); | |
hold off | |
colormap jet | |
% animation | |
steps = 2e3; % vary this to play with the animation speed | |
for n=1:steps | |
qp = (n)/steps*2; | |
T = abs((wp.*s)./((s.^2) + (wp.*s./qp) + (wp.^2))); | |
T = min(T,Tmax); | |
fig.ZData = abs(T); | |
drawnow limitrate | |
view(-10+(n/steps)*20, 60); % automatic rotation of the figure | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment