03-05-2014 05:52 PM
Hi All.
I have a DAQ-MX file that brings in a 1-D array of waveforms. This will either have six, seven, or eight waveforms (depending on previous settings). Regardless of how many there are, I want to take the first six of these waveforms, and do a matrix multiplication.
That is, if A is my 6x1 of the voltages read in by the DAQ, I want to multiply that matrix by B, a 6x6 of constants.
Is this possible?
Thanks,
James
Solved! Go to Solution.
03-05-2014 07:28 PM
I figured I better give a bit more information regarding what it is I'm trying to achieve.
I have a force balance that measures three forces and three moments. This is read into labview as six voltages with a DaqMX. To convert from voltage to the forces/moments I have a 6x6 calibration matrix. One way for me to achieve this is to split the signal into six individual signals. Then multiply each of them by the six corresponding coefficients and add them together. This seems very cumbersome. Is there a way I can do this directly with a matrix multiplication?
Thanks,
James
03-05-2014 07:36 PM
There are express VI's that convert to and from the dynamic datatype. Try using the From DDT to convert your 1-D array of waveforms to a 2-D array of doubles. (You'll have a coercion dot going in because it will coerce the1-D array of waveforms to the blue dynamic datatype.)
Or you can autoindex through the 1-D array of waveforms. Wire a 6 to the N terminal. Inside, Use Get Waveform component to get the array of data, then array subset to get the first 6 elements. Autoindex on the way out to build it back to a 2-D array.
03-05-2014 09:27 PM
Thanks for that. Will that do the multiplication on every data point in the waveform? Or only the last six?
I'm hoping to do it on the entire waveform.
03-06-2014 03:01 AM
Hi,
If you have 1-D array and 2-D array multiplication is possible with Solve Linear Equations VI (Mathematics - Linear Algerbra).
Hope this helps!
Simyfren
03-06-2014 09:06 AM
If you are just trying to multiply every element within a waveform by a number, then you are NOT doing matrix multiplication. So don't use that terminology.
You just want to multiply. You don't have matrices, you just have arrays. You can multiple a 6 element waveform array by a 6 element 1-D array directly. Each element in a particular waveform will be multiplied by the same constant within the 1-D array.
03-06-2014 03:55 PM
But I do want to perform matrix multiplication. See the image below.
If these were the time-averages of the voltages or anything else then I would be fine in setting it up, I just can't figure out how to do it when they are waveforms.
Thanks,
James
03-06-2014 04:26 PM
Then do what I said in message 3.
You started confusing things when you started talking about applying constants to the entire waveform. It is impossible to do a 6x6 times 6x1 matrix multiplcation if you are talking about every point in a waveform which is going to have more than 6 points.
Looking at your latest equation, is the 6 x 1 vector represent a single element in time from the 6 Waveforms? If so, use the first part of what I said in message 3 to convert your 1-D array of waveforms to a 2-D array. Then iterate through the 2-D array 1 column or 1 row at a time (which ever dimension gives you the single time element from the 6 different channels). You may be able to auto-index depending on the direction. Then use that 6 element 1-D array to to your matrix multiplication with your 6x6 matrix.
03-06-2014 05:36 PM
Yep did that and it works fine. Thank you very much.