Skip to content

Commit

Permalink
Added Polar Frequency Range
Browse files Browse the repository at this point in the history
  • Loading branch information
zrajani committed Jan 7, 2020
1 parent 9012a95 commit 794b1f0
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions polar_plot_for_range_of_frequencies.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
%------------Polar plots----------------------------

%------Drawing for given frequency range------------

%----Program to draw polar plot for 2 different frequencies-----

clear all;
close all;
clc;
s=tf('s')
disp('The given transfer function is, ');
Gs=1/(s*(1+0.2*s)*(1+0.05*s))

%Determine co-efficients of G(s)

[num,den]=tfdata(Gs);

w1=0.6:0.001:8; %Specify frequency range 1

%Determine the real and imaginary parts
[re1, im1,w1]=nyquist(num,den,w1);

%onvert rectangular to polar coordinates

z1=re1+i*im1;
r1=abs(z1);
theta1=angle(z1);

%Draw the polar plot
subplot(1,2,1);
polar(theta1,r1,'k');
title('Frequency Range for 0.6 rad/sec to 8 rad/sec');

w2=5:0.001:18;
[re2 im2 w2]=nyquist(num,den,w2);
z2=re2+i*im2;
r2=abs(z2);
theta2=angle(z2);
subplot(1,2,2);
polar(theta2,r2,'k');
title('Frequency Range for 5 rad/sec to 18 rad/sec');

%figure
%plot(re2,im2) %To plot on the normal graph sheet
%grid on

0 comments on commit 794b1f0

Please sign in to comment.