magnitude and phase response
이전 댓글 표시
i have to plot magnitude and phase response of a real time signal
my code:
t = linspace(0,1,1000); A = 10; f = 5; phi = pi/4;
sig = A*sin(2*pi*f*t + phi); plot(t , sig)
res = fft(sig); plot(t,res) res1 = abs(sig); plot(t,res1)
i am confused in fft part, or suggest me other commands through which i can find magnitude and phase
답변 (2개)
Daniel Shub
2011년 12월 10일
0 개 추천
Maybe I am missing something, but isn't the magnitude A and the phase phi?
Greg Heath
2011년 12월 12일
0 개 추천
N = 1000, tmax = 1, dt = tmax/(N-1), Fs = 1/dt, T = N*dt
t = linspace(0,tmax,N);
t = dt*linspace(0,N-1,N);
t = linspace(0,T-dt,N);
A = 10; f0 = 5; phi = pi/4;
sig = A*cos(2*pi*f0*t + phi); % NOTE: cos, NOT sin
figure(1); plot(t , sig)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
df = Fs/N, fmax = (N-1)*df
f = linspace(0,fmax,N);
f = df*linspace(0,N-1,N);
f = linspace(0,Fs-df,N);
SIG = fft(sig); absSIG = abs(SIG); phaseSIG = angle(SIG); figure(2), t(t,res) rsees1 = abs(sig); plot(t,res1)
댓글 수: 1
Greg Heath
2011년 12월 12일
Delete:
t(t,res) rsees1 = abs(sig); plot(t,res1)
카테고리
도움말 센터 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!