help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

resolution in the fft


From: Markus Feldmann
Subject: resolution in the fft
Date: Tue, 09 Jun 2009 20:34:49 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Hi All,

i made a spectrum on a charge/discharge function, but i am not sure how
to raise the xscale resoultion in my spectrum.

Any ideas ?

Here comes my function:
%Konstanten
FS=10e6
T1=1e-6;
T2=2e-6;
t1=0:1/FS:5e-6;
t2=0:0.1e-6:10e-6;
t=[t1,t2+t1(end)];
U0=10;
%charge
u1=U0*(1-exp(-t1/T1));
%discharge
u2=U0*exp(-t2/T2);
u=[u1,u2];
subplot(2,1,1)
plot(t,u,'-+o')
xlabel('Time/s');
ylabel('Voltage/V');
grid('on')
%FFT
nfft= 2^(nextpow2(length(u)))
fftu = fft(u,nfft);
NumUniquePts = ceil((nfft+1)/2)
fftu = fftu(1:NumUniquePts);
mu = abs(fftu)/length(u);
mu = mu.^2;
if rem(nfft, 2)
        mu(2:end) = mu(2:end)*2;
else
        mu(2:end -1) = mu(2:end -1)*2;
end
f = (0:NumUniquePts-1)*FS/nfft;
subplot(2,1,2)
plot(f,mu,'-+o')
xlabel('Frequency/Hz');
ylabel('Power');
grid('on')
axis([0,1e6])
print -deps >exponential.eps




reply via email to

[Prev in Thread] Current Thread [Next in Thread]