How to plot Bode diagram from input and output data
이전 댓글 표시
I want to plot bode diagram from input and output data. Also, I should able to change frequency range and amplitude should be in dB.
Thank you,
채택된 답변
추가 답변 (2개)
Naty Shemer
2017년 2월 6일
Hey, I have attempted what you've suggested to get the Bode plot right. Something' doesn't seems right with my bode plot. Any idea what I am doing wrong?
L=length(Cmd);
n = 2^nextpow2(L);
Fs=100;
f=Fs*(0:(n/2)-1)/n;
CmdFFT=fft(Cmd,n);
FdbckFFT=fft(Fdbck,n);
H=FdbckFFT./CmdFFT;
HH=H(1:end/2);
HMag=abs(HH);
HPh=(angle(HH));
figure;
ax1=subplot(2,1,1);
semilogx(f*2*pi,20*log10(HMag));
grid on
ax2=subplot(2,1,2);
semilogx(f*2*pi,HPh*57.3);
grid on
linkaxes([ax1 ax2],'x')
Hamidreza Hoshyarmanesh
2019년 8월 21일
0 개 추천
This is a bit late responding this post, however I thought a quick response could be useful for those who might face the same problem in the future.
When calling semilogx(f*2*pi,HPh*57.3) to plot the phase digram, Matlab ignores the imaginary part of the HH (due to HMag=abs(HH);) and you will get zero as the output.
댓글 수: 1
Sumit Swain
2021년 4월 14일
Consider having the input and output data from experiment in sine wave form. How to plot the bodeplot in matlab from the input and the output data?
카테고리
도움말 센터 및 File Exchange에서 Uncertainty Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!