MATLAB Answers

Finding the wanted linear combination of two parameters

4 views (last 30 days)
Markus Toivonen
Markus Toivonen on 8 Jun 2018
Answered: Prajit T R on 11 Jun 2018
I am not necessarily looking for the 100% right answer, maybe rather get feedback on how to approach solving this or what areas of mathematics to research to solve this type of problem. If this is not appropiate place to post this, feel free to flag/remove it. Thank you.
I have two different signals:
a*s1
b*s2
And their superposition is
s3 = (a*s1)+(b*s2)
I want to solve the coefficients a and b, so that the maximum value of the superposition, c, and the index where that value occurs, idx, is fixed. So for example, c would be 100 and idx = 106.
Some type of iteration is needed, but what would be the optimal way to do it? I can only think of two for loops that would loop over all the values of a and b (the range would be something like [0 1000] with steps of 0.1), and finding the closest approximation, by comparing to the best previous value we have stored.

  1 Comment

Matt J
Matt J on 8 Jun 2018
This, in general, is impossible. Suppose s1 and s2 and hence also s3 are both linear ramps. You do not have the freedom to specify idx arbitrarily in that case. The maximum must occur either at s3(1) or s3(end).

Sign in to comment.

Answers (1)

Prajit T R
Prajit T R on 11 Jun 2018
Hi Markus
Taking your example of c=100 and idx=106, you wish to find the values of 'a' and 'b' such that value of maximum superposition at the index position is 'c'. We can simplify the equation to get:
c = a*s1(idx) + b*s2(idx)
Let us say the values of s1(idx) and s2(idx) are 6 and 10 respectively. The equation now becomes:
100 = 6*a + 10*b
Now you can obtain a curve for this data and get its maxima. As you suggested, the complexity is O(n^2) as we have to loop over the values of 'a' and 'b'. As we need two equations to solve a two-variable problem, this is the way forward. Unless you have a specific bound for the values of 'a' and 'b', in which case we have the second equation to help us solve for 'a' and 'b'.
With a single equation, there are infinite possible values for 'a' and 'b' and the maximum value may be any of those.
Hope this helps.
Prajit

  0 Comments

Sign in to comment.

Sign in to answer this question.

Products


Release

R2015b