Can someone help me shorten this expression?

GoldWave general discussions and community help
Post Reply
Moonmist
Posts: 30
Joined: Sat May 16, 2009 3:24 pm
Location: The Milky Way Galaxy

Can someone help me shorten this expression?

Post by Moonmist »

Hi!

I want to create a sine wave but with harmonics (all - both odd and even) that roll off in amplitude (each harmonic is lower than the previous one starting with the fundamental and going up) but I want to do it linearly and not logarithmically... not sure if I said that right, but the way it would look in the spectrum filter... if you look at the tones (set the FFT size to 16) and you created a point on the top of each harmonic the line would be straight and not curving downward. Here's the expression I came up with so you can see what I mean, just paste this into the goldwave expression evaluator and enter like 110 into the "f" box (or whatever frequency you like):

Code: Select all

sqrt(1/10^((log(01)/log(2))*2))*sin(2*pi*t*f*01)+
sqrt(1/10^((log(02)/log(2))*2))*sin(2*pi*t*f*02)+
sqrt(1/10^((log(03)/log(2))*2))*sin(2*pi*t*f*03)+
sqrt(1/10^((log(04)/log(2))*2))*sin(2*pi*t*f*04)+
sqrt(1/10^((log(05)/log(2))*2))*sin(2*pi*t*f*05)+
sqrt(1/10^((log(06)/log(2))*2))*sin(2*pi*t*f*06)+
sqrt(1/10^((log(07)/log(2))*2))*sin(2*pi*t*f*07)+
sqrt(1/10^((log(08)/log(2))*2))*sin(2*pi*t*f*08)+
sqrt(1/10^((log(09)/log(2))*2))*sin(2*pi*t*f*09)+
sqrt(1/10^((log(10)/log(2))*2))*sin(2*pi*t*f*10)+
sqrt(1/10^((log(11)/log(2))*2))*sin(2*pi*t*f*11)+
sqrt(1/10^((log(12)/log(2))*2))*sin(2*pi*t*f*12)+
sqrt(1/10^((log(13)/log(2))*2))*sin(2*pi*t*f*13)+
sqrt(1/10^((log(14)/log(2))*2))*sin(2*pi*t*f*14)+
sqrt(1/10^((log(15)/log(2))*2))*sin(2*pi*t*f*15)+
sqrt(1/10^((log(16)/log(2))*2))*sin(2*pi*t*f*16)+
sqrt(1/10^((log(17)/log(2))*2))*sin(2*pi*t*f*17)+
sqrt(1/10^((log(18)/log(2))*2))*sin(2*pi*t*f*18)+
sqrt(1/10^((log(19)/log(2))*2))*sin(2*pi*t*f*19)+
sqrt(1/10^((log(20)/log(2))*2))*sin(2*pi*t*f*20)+
sqrt(1/10^((log(21)/log(2))*2))*sin(2*pi*t*f*21)+
sqrt(1/10^((log(22)/log(2))*2))*sin(2*pi*t*f*22)+
sqrt(1/10^((log(23)/log(2))*2))*sin(2*pi*t*f*23)+
sqrt(1/10^((log(24)/log(2))*2))*sin(2*pi*t*f*24)+
sqrt(1/10^((log(25)/log(2))*2))*sin(2*pi*t*f*25)+
sqrt(1/10^((log(26)/log(2))*2))*sin(2*pi*t*f*26)+
sqrt(1/10^((log(27)/log(2))*2))*sin(2*pi*t*f*27)+
sqrt(1/10^((log(28)/log(2))*2))*sin(2*pi*t*f*28)+
sqrt(1/10^((log(29)/log(2))*2))*sin(2*pi*t*f*29)+
sqrt(1/10^((log(30)/log(2))*2))*sin(2*pi*t*f*30)+
sqrt(1/10^((log(31)/log(2))*2))*sin(2*pi*t*f*31)+
sqrt(1/10^((log(32)/log(2))*2))*sin(2*pi*t*f*32)
Each line is basically a harmonic, the text on each line before the "*sin" represents the amplitude of the harmonic...
So those good at math might already know exactly what I'm trying to achieve now by seeing the math I'm using...

Well of course if I wanted to do more than 32 harmonics it would take forever to type by hand! So I was wondering if anyone good with math knows an expression that would generate harmonics all the way up to the nyquist frequency automatically and in a shorter expression?

And then if possible to also have the expression set so that one of the x or y variables could control the factor at which the harmonics roll off.

If someone could come up with an expression for me that could achieve this, I'd be very grateful!
GoldWave Inc.
Site Admin
Posts: 4372
Joined: Wed Mar 10, 2004 6:43 pm
Location: St. John's, NL
Contact:

Re: Can someone help me shorten this expression?

Post by GoldWave Inc. »

GoldWave's Expression Evaluator doesn't support loops, so I don't think there is a way to shorten it.

Chris
Post Reply