magnitude and phase response
Mostrar comentarios más antiguos
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
Respuestas (2)
Daniel Shub
el 10 de Dic. de 2011
0 votos
Maybe I am missing something, but isn't the magnitude A and the phase phi?
1 comentario
pinna Afff
el 10 de Dic. de 2011
Greg Heath
el 12 de Dic. de 2011
0 votos
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 comentario
Greg Heath
el 12 de Dic. de 2011
Delete:
t(t,res) rsees1 = abs(sig); plot(t,res1)
Categorías
Más información sobre Spectral Measurements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!