04-01-2020 07:09 PM - edited 04-01-2020 07:40 PM
Hello,
I am having some issues generating a Toeplitz Matrix. All I need to generate this matrix is the first row and the first column.
• In fact, the upper left element of this matrix is common to the first element of the top row and the first element of the leftmost column.
• Each consecutive row of the matrix is shifted by one position.
Example You may test the functionality of this vi by entering relatively short arrays for the first row and column and see what is produced.
• For example, if the first row is the array [4 3 2 1] and the first column is the array [4 5 6 7 8], the resulting Toeplitz
matrix should be
4 3 2 1
5 4 3 2
6 5 4 3
7 6 5 4
8 7 6 5
I was given the following file to work (see attached file)
Thank you
See file attached
04-01-2020 08:59 PM
So what have you tried? I would expect to see an Array somewhere (perhaps two one-dimensional Arrays, "Top Row" and "Left Column", with Top Row[0] = Left Column[0] (as they represent the same element of the Toeplitz Matrix). Actually, I'd probably create a Toeplitz Array, as Arrays are so "built-in" to LabVIEW, and if I needed a Matrix, would do the transformation at the last step.
You should attach your code (please attach a VI, not a picture, as we can't edit/test/modify a picture). It would also help us understand what you know about LabVIEW (many of us have the "urge to teach", particularly as many of us can't "go to work" and are confined to our homes).
You, of course, are correct that with the first row and first column, you can (easily) generate the entire Matrix. You should be able to do it yourself, particularly if you have spent a few hours learning LabVIEW. Show us your efforts and we can possibly point out the subtle point(s) you missed. Seeing what Structures and Functions you choose to use will be quite revealing ...
Bob Schor
04-01-2020 09:13 PM
Bob_Schor,
Thanks for the message. I am attaching what I have been trying for days, but I am not sure if this is correct.
Also, the instructions say:
Each consecutive row of the matrix is shifted by one position
• So, the second row of the Toeplitz matrix will start with the second element of the first column, and continue with the first (n-1) elements of the first row (assuming an mxn matrix).
You may test the functionality of this vi by entering relatively short arrays for the first row and column and see what is produced.
• For example, if the first row is the array [4 3 2 1] and the first column is the array [4 5 6 7 8], the resulting Toeplitz
matrix should be • In general, row i will start with the ith element of the first column, and continue with the first (n-1) elements of row i-1.
Thanks for your help. I am new to Labview.
04-01-2020 10:17 PM
Here are some suggestions:
Bob Schor
04-01-2020 10:46 PM
- Unfortunately, our Professor wants us to use the complex instead of DBl. The only 3 elements that he gave us is the Row (complex), Column (complex) and Toeplitz (output).
That is why I am so confused and I am looking for help. We have never used complex before.
-Thanks, I will try to look into arrays and for loops.
- I heard about Shift registers before, but never applied.
- I am not a programmer but I have tried to do this in paper using my little knowledge of for loops and add registers that I learned like +5 years ago.
Thanks.
04-02-2020 01:14 AM - edited 04-02-2020 01:17 AM
Hi Michi,
so this is a homework job to learn LabVIEW?
Have you taken any of the training courses until now? (You know they are offered for free until end of April?)
Some ideas:
Try to understand how they work while you recreate them…
(The datatype of the inputs is not important for the algorithms, there is no difference if they work with U8, I32 like shown, or CDB data.)
04-02-2020 06:58 AM
GerW,
Thanks for the information. Yes, this is a homework to learn Labview but because the classes now are online is getting more difficult to understand the professor.
No, I haven't taken any other training.
I will apply those examples that you sent me. If you can provide me more tips, I would appreciate it.
Thanks
04-02-2020 09:22 AM
@Michi_Fu wrote:
No, I haven't taken any other training.
If you can provide me more tips, I would appreciate it.
He did! Take the free training offered by NI. The first page of the Forum lists some Training material, you can search NI.com for "LabVIEW Training", and can search the Web.
LabVIEW is an acronym for Laboratory Virtual Instrument Engineering Workbench. The notion of a "Laboratory" should suggest "doing an Experiment", which should suggest "It's OK to simplify things by using Integers instead of Complex Number" -- you are trying to figure out an algorithm (a "method for doing something"), and it is often easier to "solve a simpler problem" first before tackling the Entire Task.
This is why Pencil and Paper make a good starting point. Watch what you do. I'll bet you didn't try using pencil and paper, did you? And if you did, you almost certainly didn't bother with writing down "4+7i, 3-4i, ...", but used "4, 3, ...". Solve the simple first, understand what you did, then write the code.
Bob Schor
04-02-2020 11:30 AM - edited 04-02-2020 11:34 AM
@Michi_Fu wrote:
- Unfortunately, our Professor wants us to use the complex instead of DBl.
Seems you are using LabVIEW 9.0, which is ancient. If you would be using LabVIEW 2019 instead, you would write and test the VI in I32, save it with a vim extension (e.g. "Create-Toeplitz.vim") and it will work correctly as subVI with whatever datatype you wire to it. (Of course you would want to add some type specialization checks to ensure the wired inputs really are 1D arrays, etc.)
I came up with something similar to Gerd. Study them all and try to understand the purpose of every single item. Find them in the palette. Look at the help! 😉
Note that there are a few landmines if you are not careful reproducing the code from scratch. For example: Why is nothing else wired to "delete from array"? Why is the "built array" output a 1D array instead of a 2D array?
04-02-2020 12:03 PM - edited 04-02-2020 12:07 PM
Thank you altenbach.
I used GerdW info too. I got this when I used the first example that he posted:
I manually typed the values for just the first row and first column and I got this:
I think is correct, right?
I am using Labview 2019, professor's template is old.
Thanks.