# add the magnitude ratio and the phase angles data points on bode diagram

13 views (last 30 days)
Commented: Star Strider on 27 Jan 2023
I plotted a bode diagram and wanted to add some magnitude ratio and phase angle to it , however it seems I can not get it right so please help with that .
w=[0.2 0.3 0.4 0.5 0.6 0.7 ];% frequency
mag=[61.1250012 55.9468284 53.92586737 52.3231432 51.3640345 50.0399108];% Magnitude Ratio
ph=[83.964 355.2663 156.7372 1166.141 1434.389 1432.116]; % phase angle (degree)
nz=0; np=1; %
zfr= mag.*exp(1j*ph);
data=frd(zfr,w);
Gc=tfest(data,np,nz);
Gc

Star Strider on 26 Jan 2023
I am not certain what you want for the result.
The fit is not the best, however the compare function will plot the data and the estimated transfer function together in one plot —
w=[0.2 0.3 0.4 0.5 0.6 0.7 ];% frequency
mag=[61.1250012 55.9468284 53.92586737 52.3231432 51.3640345 50.0399108];% Magnitude Ratio
ph=[83.964 355.2663 156.7372 1166.141 1434.389 1432.116]; % phase angle (degree)
nz=0; np=1; %
zfr= mag.*exp(1j*ph);
data=frd(zfr,w);
Gc=tfest(data,np,nz);
Gc
Gc = -6.131 ---------- s + 0.2454 Continuous-time identified transfer function. Parameterization: Number of poles: 1 Number of zeros: 0 Number of free coefficients: 2 Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using TFEST on frequency response data "data". Fit to estimation data: 1.695% FPE: 5525, MSE: 2762
figure
compare(data, Gc)
grid .
Star Strider on 27 Jan 2023
Thank you!
I did not realise that constraining the numbers of poles and zeros was a requirement. In that event, the only way to get more accuracy is to gather more data.
If that is also not an option, then this is the best you can do —
w=[0.2 0.3 0.4 0.5 0.6 0.7 ];% frequency
mag=[61.1250012 55.9468284 53.92586737 52.3231432 51.3640345 50.0399108];% Magnitude Ratio
ph=[83.964 355.2663 156.7372 1166.141 1434.389 1432.116]; % phase angle (degree)
nz=0; np=1; %
data=frd(zfr,w);
Gc=tfest(data,np,nz);
Gc
Gc = -137.4 ----------- s - 0.05004 Continuous-time identified transfer function. Parameterization: Number of poles: 1 Number of zeros: 0 Number of free coefficients: 2 Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using TFEST on frequency response data "data". Fit to estimation data: 9.975% FPE: 4.719e+05, MSE: 2.359e+05
figure
compare(data, Gc)
grid At the very least, now the ‘mag’ and ‘ph’ units are compatible with the frd requirements. That may be the best that can be done with these data.
.