How to determine time-domain amplitude from frequency domain
16 views (last 30 days)
Show older comments
I'm a bit stuck here, so any help is appreciated.
So I'm trying to derive the amplitude (time-domain) of a damped sine from the frequency domain. As a test case I'll be generating my damped sine so I know what the amplitude should look like. For my I application I will not be able to do so as I will be using real signals that I dont have the parameters for (I am actually deriving them!)
The only parameter I'm struggeling with is the amplitude, I got my frequency, phase and damping with less than 1% error. My original signal looks like the snippet below and note that I only have a few samples (100!).
fs = 2e6;
t = 0:(100-1);
b = -zeta*2*pi*freq/fs;
c = 2*pi*freq/fs;
x = ampl*(exp(b.*t)).*sin(c*t+phi/180*pi);
I apply a Hamming window to my signal and perform an fft. Run it through my algorithm and I get accurate parameters for Freq, Zeta and Phi (frequency, damping and phase). So you may assume that those are known. I do compute a magnitude (i.e. amplitude in frequency domain, I'll refer to it as magnitude to prevent ambiguity) however I'm unable to correlate it to the initial (time-domain) amplitude.
Given that I can reconstruct the original signal exactly with an ifft I would imagine that I could derive the time-domain amplitude, below I've provided a working example that reconstructs the input signal.
%% parameters to construct signal
fs = 2e6;
freq = 180e3;
ampl = 44;
phi = 0;
zeta = 0.12;
n_sample = 100;
t = 0:(n_sample-1);
%% construct signal
b = -zeta*2*pi*freq/fs;
c = 2*pi*freq/fs;
x = ampl*(exp(b.*t)).*sin(c*t+phi/180*pi);
x=x';
%% Apply window, zeropad and FFT
w = hamming(length(x));
y = [w.*x; zeros(28,1)];
xFFT = fft(y)/length(y);
%% Inverse FFT
w = [w; ones(28,1)];
z = ifft(xFFT.*length(y))./w;
%% Plot
figure()
hold on
plot(x)
plot(y)
plot(z)
legend('original', 'windowed', 'reverse')
Any ideas on how I can compute the initial amplitude? So in the example above, how I can find 44?
0 Comments
Accepted Answer
David Goodmanson
on 17 Feb 2019
Edited: David Goodmanson
on 17 Feb 2019
Hi pimovietc,
I'm not sure what is going on with the use of fs in some of your expressions so I will use a different but similar example. If I understand this correctly, you have a signal
x = A*exp(b.*t).*sin(w*t+phi*pi/180);
and through some process in the frequency domain you have determined b,w and phi. Now you need to find A. It's not even necessary to have phi. Using the same t array as before,
t = t(:);
x = x(:);
u = [exp(b*t).*sin(w*t) exp(b*t).*cos(w*t)]; % two basis vectors
d = u\x; % determine basis vector coefficients
A = norm(d)
phi = atan2d(d(2),d(1)) % atan2d for degrees
or, if you are confident in your calculation of phi,
t = t(:);
x = x(:);
u = exp(b.*t).*sin(w*t+phi*pi/180);
A = u\x
.
More Answers (0)
See Also
Categories
Find more on Hamming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!