magnitude and phase response
Ältere Kommentare anzeigen
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
Antworten (2)
Daniel Shub
am 10 Dez. 2011
0 Stimmen
Maybe I am missing something, but isn't the magnitude A and the phase phi?
1 Kommentar
pinna Afff
am 10 Dez. 2011
Greg Heath
am 12 Dez. 2011
0 Stimmen
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 Kommentar
Greg Heath
am 12 Dez. 2011
Delete:
t(t,res) rsees1 = abs(sig); plot(t,res1)
Kategorien
Mehr zu Spectral Measurements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!