MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by Hrushikesh on 15 Jun 2013

suppose i have a sinusoidal wave with multiple frequencies in it..and it dies out after some time...just like the plot of sprung mass displacement subjected to damping...in a suspension system .. i referred various videos ..in which they represented the main signal into a form y=A1*(sin (2*pi*f1*t+phase diff))+A2 *(sin(2*pi*f2*t))+A3...and so on...so they did quantization of the main signal...but if your main signal has multiple frequencies in it...quantising will be difficult and time consuming...and how do you represent the main signal into the form i mentioned above..(any short cut available in matlab to get the main signal directly into the form as stated above...rather than evaluating each part manually...)i need for FTT transformation..early help is appreciated..

*No products are associated with this question.*

Answer by Wayne King on 15 Jun 2013

Edited by Wayne King on 15 Jun 2013

Accepted answer

If you know the frequencies, amplitudes, and phases, then yes, it is very easy to construct signal which is a superposition of sinusoidal components. You can create them one by one and add them together, or you can create them in matrix form and sum the columns or rows to get the final signal.

t = (0:1e-4:1)'; omegas = 2*pi*(100:100:600); t = repmat(t,1,6); omegas = repmat(omegas,size(t,1),1); omega = omegas.*t; phi = -pi+2*pi*rand(1,6); phi = repmat(phi,size(t,1),1); theta = 2*pi*omega+phi; y = cos(theta); y = sum(y,2);

I haven't included the exponential decay term, but it easy to do.

Conceptually simplier is to create them like this:

t = (0:1e-4:1)'; y = exp(-0.5*t).*cos(2*pi*100*t-pi/4)+ 0.5*exp(-0.5*t).*cos(2*pi*t-pi/2);

## 0 Comments