How do I adjust 2 variables to minimize the difference between 2 waveforms?

L

LongBeachGuy

I have a sub that works with a sine wave. It has three variables which
are for the phase and the frequency and total difference in spikes.
The sub starts off with a unit circle from zero to 2pi.

The variable for the phase is added to the angle and then the sine
results are generated. The variable for the frequency is multiplied to
the angle and the sine results are generated. In a chart, there is
another object that is just spikes. The aptitude is from 0% to 100%.

I have 1000 points on the x axis. At each point that is the same on
the x axis, the difference of the amplitudes is taken. Then the
differences are added up. There is a third variable that sums up the
total differences for all the spikes excluding the empty points. The
closer a match the 2 waveform are the smaller the total difference
becomes. The total difference will never be zero but some number.

The MAX aptitudes of both objects are the same. Each object starts &
ends @ same points.

How do I adjust the phase and frequency variables so that the total
difference between both waveforms per valid spikes is minimized?

How can I use the same variable names from the original sub in a main
sub using the same ending values from the original sub?

How can I also have the chart object updated and viewed as the
variables are altered?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top