Z = harmonicseries(AMP, PER, PHA, LEN, DIR, T, X, Y);
Performs the sum of harmonics:
z(t,y,x) = sum [ a*cos(k*x + l*y - w*t + theta) ]
a = AMP (amplitude)
k = K*cos(rdir) (x-component of wavenumber vector)
l = K*sin(rdir) (y-component of wavenumber vector)
K = sqrt(k^2+l^2) = (2*pi)./LEN (magnitude of wavenumber vector)
rdir = DIR*(pi/180) (direction of wavenumber vector in radians)
w = (2*pi)./PER (Temporal angular frequency)
theta = PHA*(pi/180) (Initial phase in radians)
This is useful when performing tests of Fourier Spectral Analysis, for example.
The program comes with the example on the screenshot.
Carlos Adrian Vargas Aguilera (2020). HarmonicSeries.m (https://www.mathworks.com/matlabcentral/fileexchange/13420-harmonicseries-m), MATLAB Central File Exchange. Retrieved .
New version. More portable/easy-to-copy.
I agree "Thomas", I need to clean the code and the inputs arguments. Although, only one person had rated it and it was good. Every comments are well-received (no matter the initial stars) although there's no need to be rude. The program does exactly what I say above and in the help. Next time be contructive. Take a look later for the new submition.
It is an excessively complex wrapper for a one line statement. This has no purpose except to make your code unreadable and less portable.
Great, an all-in-one program! I just think the initial phase must be with minus sign and also w instead of k, but great anyway...
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!