필터 지우기
필터 지우기

Split the polynomial and determine the degree of numerator and denominator

조회 수: 6 (최근 30일)
sandeep singh
sandeep singh 2019년 1월 23일
댓글: Mohsen 2019년 11월 6일
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

답변 (2개)

Steven Lord
Steven Lord 2019년 1월 23일
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
sandeep singh
sandeep singh 2019년 1월 24일
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

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2019년 1월 23일
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
sandeep singh
sandeep singh 2019년 1월 28일
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.
Mohsen
Mohsen 2019년 11월 6일
I have a challenge same you. Can you send your solution?
Regards

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by