I am trying to find the dominant poles without using a for loop...
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
This is what I have so far, and it is driven by the fact my professor says he does not want to see overly similar code as the others in my class... But I dont know how to find the dominant poles from this without a for loop like so many of my classmates will have... Any Ideas?
num=[3 3];
den=[conv([1 0],[conv([1 4],[1 7])])]
Gs1=tf(num,den)
hold on
rlocus(Gs1)
GS1=zpk(Gs1)
%%
R=[-0.1:-0.3:-5.8];
I=i*[0.01:0.01:0.5];
[Re Im]=meshgrid(R,I);
p=Re+Im;
p_s=sort(p);
%% angle from double pole at zero
Theta=180-angle(p);
Ts=sort(Theta);
%% distances from -7 to possible poles on Re axis
P4=-7;
P4d=P4-real(p_s(1,1:20));
%% distances from -4 to possible poles on Re axis
P3=-4;
P3dA=P3-real(p_s(1,1:13));
P3dO=real(p_s(1,15:20))-P3;
P3d=[P3dA,0,P3dO];
%% distance from zero poles to prime pole possible
P1_2=real(p_s);
%% Angles from "dP" to -4
ThP3A=atan2(imag(p_s(1:50,1:13)),P3dA);
ThP3O=180-atan2(imag(p_s(1:50,15:20)),P3dO);
ThP390=90*ones(1,50)';
ThP3=[ThP3A,ThP390,ThP3O];
%% Angles from "dP" to -7
ThP4=180-atan2(imag(p),P4d);
%% Finding Angle Deficiencies
ANGDef=180-ThP4-ThP3-2*Ts;
AngN=ANGDef/2;
xprime=1./tan(180-AngN);
x=[0:-.3:-5.8];
a_val1=x+xprime
0 Kommentare
Antworten (1)
Raunak Gupta
am 29 Apr. 2020
Hi,
I don’t see any for loop in the code that is provided with the question, however if there is a for loop you can always write the code using array indexing so that you will be dealing vector in a matrix rather than going in a for loop. Array indexed code is also faster than the for loop one. You may find following article and documentation useful.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Mathematics and Optimization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!