magnitude and phase response
Afficher commentaires plus anciens
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
Réponses (2)
Daniel Shub
le 10 Déc 2011
0 votes
Maybe I am missing something, but isn't the magnitude A and the phase phi?
1 commentaire
pinna Afff
le 10 Déc 2011
Greg Heath
le 12 Déc 2011
0 votes
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 commentaire
Greg Heath
le 12 Déc 2011
Delete:
t(t,res) rsees1 = abs(sig); plot(t,res1)
Catégories
En savoir plus sur Spectral Measurements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!