add the magnitude ratio and the phase angles data points on bode diagram
7 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
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
figure
compare(data, Gc)
grid
.
8 Comments
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; %
zfr= db2mag(mag).*exp(1j*deg2rad(ph));
data=frd(zfr,w);
Gc=tfest(data,np,nz);
Gc
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.
.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!