Frequency of combined waveform
13 views (last 30 days)
Show older comments
Dear all, I have two waves(one is wave load on the modal and other sinusoidal oscillation of one boundary of the modal. I combined the waves in matlab with this code.
t = 0:1:100;
x = 1.949*sin(2*pi*0.08416*t+5.97219) + 2*sin(2*pi*0.1111*t);
plot(t,x);
I want to find the frequency of the combined waveform.
Data for the wave
 Wave 1) Amplitude = 1.949m , frequency = 0.5288 rad/sec, phase angle = 5.97219
 Wave 2) Amplitude = 2m frequency = 0.69813 rad/sec, phase angle = 0
Thanks
0 Comments
Accepted Answer
Wayne King
on 4 Feb 2013
There is no way to define a single frequency for this waveform. The waveform is the superposition of 2 frequencies, 0.08416 cycles\second (sample) and 0.1111 cycles\second (sample).
4 Comments
Image Analyst
on 4 Feb 2013
0.08416 and 0.1111 are rational numbers because they're finite. Their periods are 1/0.08416 = 11.8821292775665 and 1/0.1111 = 9.000900090009, so in a distance of 106.949858483947 you'd have about 11.88 cycles of wave #1 and 9 cycles of wave #2, and the pattern would repeat again, right?
But I agree with you it's not like you can combine two monochromatic waves and get a new monochromatic wave at a different frequency. If you consider it in the Fourier domain, each wave just gives a delta function (a dot)  they don't combine to give another dot in a different location (at a new frequency).
Normally one would not say that the period (frequency) of the "pattern repeat" is some new fundamental frequency of a combined waveform. If you play your tuba at the same time as I play my piccolo, we don't suddenly sound like a clarinet.
More Answers (1)
Miroslav Balda
on 4 Feb 2013
It is not clear what you want to find. However, the next code finds all parameters of the combined wave, i.e. amplitudes, frequencies and phases of a signal composed out of 2 sinewaves:

% Azzi
%%%%%%% 4.2.2013
clc
clear all
close all
global p0 x t
N = 100;
T = 1;
T1 = N*T;
t = (0:N1)*T;
x = 1.949*sin(2*pi*0.08416*t+5.97219) + sin(2*pi*0.1111*t);
df = 1/T1;
f = (0:N1)*df;
pL = {'FontSize',12,'FontWeight','bold'}; % label font properties
pT = {'FontSize',14,'FontWeight','bold'}; % title font properties
h1 = fig(1); % www.mathworks.com/matlabcentral/fileexchange/9035
plot(t,x); hold on; grid;
xlabel('t [s]',pL{:})
ylabel('fun(t)',pL{:})
title('fun(t) = sum of two sines',pT{:})
% Find initial estimates of parameters:
X = fft(x)*T; % approximation of FT
aX = abs(X);
L = extr(aX); % www.mathworks.com/matlabcentral/fileexchange/10272
Xp = aX(L{1}); % peaks
fp = f(L{1}); % frequency at peaks
h2 = fig(2);
plot(f,aX, f(L{1}),Xp,'or'); hold on; grid;
xlabel('f [Hz]',pL{:})
ylabel('modulus of fft(fun(t))',pL{:})
title('fft(fun(t))',pT{:})
p0 = zeros(6,1); % Find vector of initial estimates:
p0(1:2) = fp(1:2)'; % frequencies at peaks
p0(3:4) = 2*Xp(1:2)'/N; % rough amplitude estimates
quota = imag(X(L{1}))./real(X(L{1}));
p0(5:6) = atan(quota(1:2))';% phases
% Solution of an overdetermined set of nonlinear equations
% LMFnlsq from www.mathworks.com/matlabcentral/fileexchange/17534
[p,ssq,cnt] = LMFnlsq(@resid,ones(size(p0)),'Display',1);
fprintf('\n p0 p\n\n');
fprintf('%15.10f%15.10f\n', [p0, p.*p0]');
fun = resid(p)' + x;
figure(h1);
pause(1)
plot(t,fun,'r')
The program applies three functions from FEX  fig for figure placement, extr for finding extremal values in a vector, and LMFnlsq for least squares solution of an overdetermined system of nonlinear equations by LevenbergMarquardt method in Fletcher's modification.
The code is able to solve more general task then the given one  all frequencies, amplitudes and phases are assumed being unknowns. The solution p of the given problem has been found in 9 iterations starting from the initial estmates p0, which have been obtained applying FFT to given time series. The initial parameters p0 and the obtained solution p have been
 p0 p
0.0800000000 0.0841600000
0.1100000000 0.1111000000
1.4570270622 1.9489999990
0.7896867594 1.0000000004
0.5751678654 0.3109953111
1.3988961788 0.0000000020
Since the p parameters practically equal those from the formula for x, the original line and that with evaluated p coincide.
Sorry, if you need something else.
See Also
Categories
Find more on Continuous Waveforms in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!