Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Linear equation matrix solver

Post any examples or modules that you want to share here

Linear equation matrix solver

Postby KG_is_back » Fri Feb 21, 2014 8:00 pm

The name says it all. It solves linear matrices via Gaussian elimination. You input the number of equations N and the float array in form of [a,b,c,..,z,constant,a,b,...,z,constant,...] and output is solution for [a,b,...,z]. The Array must be of size N*(N+1) or will be resized to that size.
Known bugs:
-Precision is a little problem... sometimes x/x-y/y is not zero, So I had to round small numbers to zero in the algorithm.
-Only non-singular matrices can be solved. This is not really a bug, but a mathematic fact...

Please try it out and let me know what you think ;)
Attachments
linest2.fsm
(3.51 KiB) Downloaded 1090 times
Last edited by KG_is_back on Sun Feb 23, 2014 1:18 am, edited 1 time in total.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Linear equation matrix solver

Postby tester » Sat Feb 22, 2014 1:48 am

Ehm, I have no idea what for I could use it (at least right now), but I think you are doing a great job by assembling these "little things". :mrgreen: When the proper time comes - they get needed.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Linear equation matrix solver

Postby KG_is_back » Sat Feb 22, 2014 2:39 am

I personally was doing it for implementing FIR to IIR converter implementing least squares method.
You provide it with test tone before and after the filter you wanna copy (or dirac and the IR), the algorithm handles y(0) as function of x(0), x(1),... and y(1),y(2),... and least squares method approximates the A and B coefficients. That requires solving quite big matrices, so there was no way around.
Unfortunately so far I've made it to work only for first order filter... for some reason it fails solving the matrix of higher order filters including biquad.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Linear equation matrix solver

Postby tester » Sat Feb 22, 2014 12:43 pm

Is the issue related to accuracy?
If it's a matter of accuracy, then transforming it to ruby should help.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Linear equation matrix solver

Postby KG_is_back » Sat Feb 22, 2014 1:10 pm

tester wrote:Is the issue related to accuracy?
If it's a matter of accuracy, then transforming it to ruby should help.


I do not know... But Ruby double precision would improve the precision a lot - precision in digital formats is general problem of Gaussian elimination. It is often followed by different method to improve the precision.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Linear equation matrix solver

Postby KG_is_back » Sun Feb 23, 2014 1:21 am

Found the bug... Now it's working properly, I updated the schematic in first post... Still, the precision is a little problem. If someone can make it in ruby it would be great - Gaussian elimination is not that hard to implement
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Linear equation matrix solver

Postby martinvicanek » Sun Feb 23, 2014 3:29 pm

Neat! The bugfixed schematic now solves a test case that the first version didn't. Unfortunately I can't help you with Ruby but for those who are familiar with the language it should be straightforward to port some available code (e.g. Gauss-Jordan elimination, chapter 2.1 p.36ff of Numerical Recipes in C).
User avatar
martinvicanek
 
Posts: 1315
Joined: Sat Jun 22, 2013 8:28 pm

Re: Linear equation matrix solver

Postby martinvicanek » Sun Feb 23, 2014 3:36 pm

KG_is_back wrote:FIR to IIR converter

:o I thought FIR filter design was harder than IIR filter design? Or are you after reverb modelling?
User avatar
martinvicanek
 
Posts: 1315
Joined: Sat Jun 22, 2013 8:28 pm

Re: Linear equation matrix solver

Postby KG_is_back » Sun Feb 23, 2014 4:36 pm

martinvicanek wrote:
KG_is_back wrote:FIR to IIR converter

:o I thought FIR filter design was harder than IIR filter design? Or are you after reverb modelling?


Possibly... I what to create a plugin that would be able to approximate short FIR into IIR which is much more cpu friendly. (cab modeling etc.).

General equation of N-th order filter is: y(0)=x(0)*b0 + x(1)*b1 + ... x(n)*bn + (-a1)*y(1) + ... That is a linear equation with multiple variables (x,y - and their delayed versions). When you have a test tone (x) and tone passed through (y) least squares method can approximate the coefficients, so the effect on output match with original.
The equation can also be expand larger by c*htan(x) or d*(x^2) and other functions and now the system can approximate nonlinear devices too.

I already have a working prototype, but it is not ready to make public yet
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Linear equation matrix solver

Postby MegaHurtz » Sun Feb 23, 2014 5:06 pm

Havn't really heard of it before, but after a quick browse it seems to be a liniar transformation.
Which offcourse is not what it should be, right. So are you creating the non liniar version?

Edit: ^^ Yea :)
Begging for a convolution within a convolution.. Strange little paradox there, the way I see it after 5 mins is that the number of matreces also bound by a number of taps you use for it. Inproper defenition if infinite? But hey if its long its long I guess.
192k @ 8ms
User avatar
MegaHurtz
 
Posts: 105
Joined: Mon Aug 11, 2008 6:29 pm
Location: Eindhoven/Nederland

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 35 guests