Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

matlab function for amplitude

Status
Not open for further replies.

MachinaMan

Mechanical
Aug 30, 2003
70
Hi all,

I need some help finding a certain function (if it exists)

I have 2 vectors of experimental data (in sine form of amplitude vs frequency) and I need a function to calculate the average amplitude of my sine wave. I don't think curve fitting will work since the data is not very stable. The function needs to work directly with the experimental data.

Anyone know if this function exists and what it would be ?

Thanks

Ren
 
Replies continue below

Recommended for you

We need some clarification here.

You say "in sine form of amplitude vs frequency". Do you mean you have a spectrum? Is it a power spectrum?

What precisely do you mean by the "average amplitude of my sine wave"? Do you mean the mean of your original signal? The rms of your original signal?

M

--
Dr Michael F Platten
 
My mistake,

I have a response vs time graph for a given frequency and I want to get the amplitude of the response.

The signal is not steady for every cycle (the amplitude changes because it is experimental) so I want to find the average amplitude, (or average of the peaks and lows) not the mean or rms.

Is this clear?

Thanks,

Ren
 
You can use the Hilbert transform to find the envelope of the signal and then find the mean of that envelope to obtain an estimate of the mean amplitude.

The discrete Hilbert transform suffers from the same drawbacks as the discrete Fourier transform in that both are affected by leakage so the results are not perfect. However in the example below it seems to work quite well.

Code:
% try envelope detection with hilbert transform

% define a time vector
t = [0:0.01:9.99];

% our signal - a sine wave with a time varying amplitude
x = sin(4*pi*t); % the sine wave
envelope = 5+0.5*sin(pi*t); % the time varying amplitude
x_env = x.*envelope; % the complete signal

% add some random noise to make it look a bit
% more like measured data
signal = x_env + 0.2*rand(1,1000);

% find the hilbert transform of the measured signal
signal_h = hilbert(signal);

% square the hilbert transform and take the
% +ve square root to get the estimated envelope
envelope_est = sqrt(signal_h.*conj(signal_h));

% plot the original signal, the true envelope
% and the estimated envelope
plot(t,signal,t,envelope,t,envelope_est);

% find the mean of the true envelope
mean_true = mean(envelope)

% find the mean of the estimated envelope
mean_est = mean(envelope_est)

--
Dr Michael F Platten
 
Why would you use Hilbert rather than Fourier?



Cheers

Greg Locock
 
Hi Mikey, Greg,

I did think about Fourier but I wasn't sure on how to apply it. For Hilbert I could just measure the transform itself since it will represent the amplitude, right?

After further thinking, I'll just plot the signal and figure it out graphically since my analysis will have some significant error sources afterwards anyways.

Thanks for your help guys,

Ren
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor