×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

matlab function for amplitude

matlab function for amplitude

matlab function for amplitude

(OP)
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

RE: matlab function for amplitude

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

RE: matlab function for amplitude

(OP)
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

RE: matlab function for amplitude

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

RE: matlab function for amplitude

Why would you use Hilbert rather than Fourier?

Cheers

Greg Locock

RE: matlab function for amplitude

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now