Split the polynomial and determine the degree of numerator and denominator

7 views (last 30 days)
Hello All,
I am working with some mathematical GUI , i need to split the polynomial and determine the degree of numerator and denominator . Inputs are fed from user in gui in edit text i have attached a pseudo code where i am calculating the transfer function. I need to split
OLPZData=handles.General_test.PlantInfo.OL.UDPPZForm.PZData;
p(1)=str2double(OLPZData.p1.String);
p(2)=str2double(OLPZData.p2.String);
p(3)=str2double(OLPZData.p3.String);
p(4)=str2double(OLPZData.p4.String);
p(5)=str2double(OLPZData.p5.String);
m=str2double(OLPZData.PolesAtOrigin.String);
if p(1)==0 || p(2)==0 || p(3)==0 || p(4)==0 || p(5)==0
hObject.BackgroundColor=[1 0.8 0.8];
return;
else
hObject.BackgroundColor=[1 1 1];
end
P= sum(~isnan(p));
if isnan(m)
m=0;
handles.General_test.PlantInfo.OL.UDPPZForm.PZData.PolesAtOrigin.String ='0';
handles.General_test.PlantInfo.OL.UDPPZForm.PZData.PolesAtOrigin.BackgroundColor=[1 1 1];
end
z(1)=str2double(OLPZData.z1.String);
z(2)=str2double(OLPZData.z2.String);
z(3)=str2double(OLPZData.z3.String);
z(4)=str2double(OLPZData.z4.String);
z(5)=str2double(OLPZData.z5.String);
Kdc=str2double(OLPZData.Kdc.String);
Z= sum(~isnan(z));
%Kdc(isnan(Kdc))=1;
if isnan(Kdc)
Kdc=1;
handles.General_test.PlantInfo.OL.UDPPZForm.PZData.Kdc.String ='1';
handles.General_test.PlantInfo.OL.UDPPZForm.PZData.Kdc.BackgroundColor=[1 1 1];
end
if z(1)==0 || z(2)==0 || z(3)==0 || z(4)==0 || z(5)==0 ||Kdc==0
hObject.BackgroundColor=[1 0.8 0.8];
return;
else
hObject.BackgroundColor=[1 1 1];
end
Gvd=Kdc/((s/(2*pi))^m);
PmultiFactor=zeros(1,5);
ZmultiFactor=zeros(1,5);
DENOMM=zeros(1,5);
for i=1:5
PmultiFactor(i)=double(~isnan(p(i)));
ZmultiFactor(i)=double(~isnan(z(i)));
Gvd=Gvd*(1+s*ZmultiFactor(i)/(2*pi*z(i)))/(1+s*PmultiFactor(i)/(2*pi*p(i)));
hip = zpk(Gvd);
hip.DisplayFormat = 'frequency';
handles.General_test.PlantInfo.OL.PlantTF=Gvd;
%PlotGeneration(hObject);
end
extract numerator and denominator of Gvd
Thanks in advance

Answers (2)

Steven Lord
Steven Lord on 23 Jan 2019
From the fact that this question is tagged "control systems" and you're calling the zpk function in your code, it sounds like you want to obtain the numerator and denominator of that transfer function. Looking at the documentation for the zpk object it has properties Z and P that contain the zeros and poles of the transfer function. You can use the poly function to create the polynomial with those roots or you could use the zp2tf function to convert your zpk object into a tf object then access that tf object's Numerator and Denominator properties.
  1 Comment
sandeep singh
sandeep singh on 24 Jan 2019
Hi Steven,
zp2tf function This is not working as my ZPK are in cell format .Any how i found the way to solve its lengthy but getting needed results.
thanks for all

Sign in to comment.


Walter Roberson
Walter Roberson on 23 Jan 2019
By definition, the degree of the denominator of a polynomial is 0 (that is, the denominator is restricted to being a constant.)
Any system in which the independent variable appears in the denominator is not a polynomial -- not even if the expression fully cancels with the numerator.
  6 Comments
sandeep singh
sandeep singh on 28 Jan 2019
Hello Walter,
I agree Transfer functions are not polynomials, but i needed to split or parse however you take . anyhow i have found solution by myself thanks for all support and replies.

Sign in to comment.

Categories

Find more on Polynomials in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!