Using complex numbers/vectors

I am trying to use the CNiMath::FFT(CNiComplexReal64 &x) function. I don't know how to set up the CNiComplexReal64 vector - I have no information on how to format the real and imaginary parts. Any easy example would be sufficient to get going on it. I have a vector of my real values and a vector of imaginary values if that can somehow be converted to the CNiComplexReal64 type. Thanks.

Hello
Check out the fft example that is installed with Measurement Studio, you can find it under ..\MeasurementStudio\VC\Examples\Analysis\Fft.
The CNiMath::FFT has 2 overloads
static MathError FFT(
CNiComplexReal64Vector& x);
and
static MathError FFT(
CNiReal64Vector& xReal,
CNiReal64Vector& xImag);
You can use the second overload, since you already have the data in that form. Check out the documentation for the CNiReal64Vector for more informtion on its available constructors and properties.
Thanks
Bilal Durrani
NI
Bilal Durrani
NI

Similar Messages

  • Using complex numbers in Fletcher Reeves optimization method

    Hello,
    I would like to minimize a function of 4 complex variables with the Fletcher Reeves optimization method (Conjugate Gradient VI).
    Is it possible to do it with this VI or with HiQ4.5 ?
    (for S-parameters specialists) The purpose is to de-embed using optimization method.
    Thanks,
    Dze

    I believe that the "Conjugate Gradient nD.vi" and the optimize function in HiQ only work with real vectors. Most of the solve functions in HiQ work with complex numbers, and you may be able to create your own algorithm for the purpose, but I don't think that there is already a function that will do quite what you want.

  • Hp 35s integrating with complex numbers/functions

    Are there any examples of how to integrate a complex function for
    the HP 35s..the manual suggests its possible..but, I can not find one
    example...anywhere... I am just interested in testing.....I do
    not want to break things into parts etc...I just want to try
    e^z for example, where z is complex..any help?
    I have tried xiy, rTheta, x+iy...syntax errors or non existent..funny

    Hi,
    The manual states that complex numbers can be used with EXP(x), but it does not mention anything about using complex numbers for integration. Edit: I missed some text in the manual, see below.
    As far as I can tell it cannot do integration with complex numbers. (The 50g can do this.)
    However, you may get a more definitive answer if you ask your question here:
    http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/forum.cgi
    EDIT: that forum has moved to a new version:
    http://www.hpmuseum.org/forum/forum-4.html
    Note: I do not work for HP, I just like playing with calculators :-)

  • SVD with complex numbers

    I'm working on creating a SVD class using complex numbers. I have an adaptation of the Jama ( http://math.nist.gov/javanumerics/jama/ ) implementation coded which works great with complex numbers with only a real part, but fails when the imaginary is present. I also coded up a port of numerical recipes' ( http://www.nr.com ) implementation, but am unable to get it to converge. I'm 99.9% sure that the problem does not exist in my complex number class as it has worked fine up until now.
    Anyhow, what I'm wondering is if anyone has a Java SVD for complex matrices that I could look at and/or use?
    Thanks in advance,
    m

    It wasn't working when I tried it a few months ago. I found the bug in the database - it's been long-standing. Given that Sun doesn't appear to be supporting Java3D very well, I doubt it'll ever be fixed.
    Besides, that SVD algorithm is only for real matricies, I believe. - MOD

  • How to use RLS with complex numbers as the input?

    I import a file which have complex numbers, and I want to filter it using complex RLS adaptive filter, but it always freeze at the filtering and update then it returns one value in the matrix and all the other numbers are NaN, so how can I fix this.
    The second thing is when I use FBLMS, it always return error 42020 unless I specify the filter length= number of the input which is huge number, so how do I specify normal filter length.

    Hi engomar,
    There is a detailed description of how to choose filter length in the Adaptive Filter Tollkit Help file. 
    http://zone.ni.com/reference/en-XX/help/372357B-01/lvaftconcepts/aft_choose_filterlength/
    This page has several links to other important factors of what filter to choose. Under Computational Resource Requirements, it lists the memory usage for different filter types. RLS is the most memory intensive, which could be causing the freeze. Maybe try a LMS to see if this helps.
    Robert R. | Applications Engineer | National Instruments

  • Exporting to PDF - How Can I Get A Small File Size When Using Lots of Vector Art?

    I am trying to create a small PDF file for e-book distribution purposes. My Indesign pages contain a variety of photographs, vector icons and vector maps.
    A publisher in Britain who does similar books on a Mac using Creative Suite was able to create a 22-page document very similar to mine (similar icons, graphics, density, etc) that is only 2.84 mb, a small fraction of the file size that I'm getting! I've included a sample page of his below, which is a low-res jpeg, but on the original PDF all of the text and images (except the jpeg cliff background) are super sharp - they look like vectors when you zoom in. I've also included screenshots of his PDF export settings.
    I don't know if he's exporting directly out of Indesign, but my best guess is that he is.
    My vector-based icons, numbers and maps are bloating my PDFs considerably. When I remove them, the Indesign and exported PDF file sizes drop dramatically. For the life of me, I can't figure out how he got such small PDF files sizes using so much vector art! The PDF graphic compression settings don't seem to include any options for vector art.
    My vector art graphics (numbering, icons, maps) are all saved as Illustrator AI files and then placed in Indesign as linked graphics. My best guess as to why I can't achieve smaller PDF files is I'm either doing something wrong with the vector graphics themselves or handling/exporting them improperly out of Indesign.
    I am using CS4 for PC and am on a Dell Machine running Windows 7.

    I am trying to create a small PDF file for e-book distribution purposes. My Indesign pages contain a variety of photographs, vector icons and vector maps.
    A publisher in Britain who does similar books on a Mac using Creative Suite was able to create a 22-page document very similar to mine (similar icons, graphics, density, etc) that is only 2.84 mb, a small fraction of the file size that I'm getting! I've included a sample page of his below, which is a low-res jpeg, but on the original PDF all of the text and images (except the jpeg cliff background) are super sharp - they look like vectors when you zoom in. I've also included screenshots of his PDF export settings.
    I don't know if he's exporting directly out of Indesign, but my best guess is that he is.
    My vector-based icons, numbers and maps are bloating my PDFs considerably. When I remove them, the Indesign and exported PDF file sizes drop dramatically. For the life of me, I can't figure out how he got such small PDF files sizes using so much vector art! The PDF graphic compression settings don't seem to include any options for vector art.
    My vector art graphics (numbering, icons, maps) are all saved as Illustrator AI files and then placed in Indesign as linked graphics. My best guess as to why I can't achieve smaller PDF files is I'm either doing something wrong with the vector graphics themselves or handling/exporting them improperly out of Indesign.
    I am using CS4 for PC and am on a Dell Machine running Windows 7.

  • In range and coerce with complex numbers?

    I have an array of complex numbers with these numbers I need to set to 0 all numbers whose real parts are negative. With "in range and coerce" I can split the array into real and imaginary then set all negative numbers to 0 then recombine the complex part but that still leaves me with 0+ai numbers that should be 0. How can I also set the complex part to zero for the negative numbers?

    Hello,
    You can use the following fonction in a for loop with your array.
    Michel

  • Complex Numbers problem

    I am having problems getting this Complex Numbers program to work correctly. i want to display using format a+bi the addition, subtraction and multiplication of 2 complex numbers.Can anyone reply today?
    class Complex
         private double realPart, imaginaryPart;
         public Complex()
              realPart = 0.0;
              imaginaryPart = 0.0;
         public static void main(String [] args)
              Complex c;
              double res;
              c = new Complex();
              Screen.message("-------------------MENU----------------------------");
              Screen.newline(2);
              Screen.message("Please enter a number: ");
              Keyboard.readDouble();
              res = c.get_realPart();
              Screen.newline();
              Screen.message("Please enter a second number: ");
              Keyboard.readDouble();
              res = c.get_imaginaryPart();
              Screen.newline(2);
              Screen.message("--------------------------------------------------");
              Screen.newline();
              Screen.message("     Designed by Niall Magner               ");
              Screen.newline();
              Screen.message("--------------------------------------------------");
              Screen.newline(2);
              Screen.writedouble(res);
              Screen.newline();
              Screen.writedouble(res);
              Screen.newline();
              Screen.writedouble(res);
              Screen.newline(2);
         public double get_realPart()
              return realPart;     
         public double get_imaginaryPart()
              return imaginaryPart;
         public void addComplexNum(Complex n1, Complex n2)
              realPart = n1.get_realPart() + n2.get_realPart();
              imaginaryPart = n1.get_imaginaryPart() + n2.get_imaginaryPart();
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
              Screen.message("Number 1 is: " + realPart);
              Screen.message(" + " + imaginaryPart + "i");
              Screen.newline();          
              Screen.message("Number 2 is: " + realPart);
              Screen.message(" + " + imaginaryPart + "i");
              Screen.newline();          
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
         public void subtractComplexNum(Complex n1, Complex n2)
              realPart = n1.get_realPart() - n2.get_realPart();
              imaginaryPart = n1.get_imaginaryPart() - n2.get_imaginaryPart();
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
              Screen.message("Number 1 is: " + realPart);
              Screen.message(" - " + imaginaryPart + "i");
              Screen.newline();
              Screen.message("Number 2 is: " + realPart);
              Screen.message(" - " + imaginaryPart + "i");
              Screen.newline();          
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
         public void multiplyComplexNum(Complex n1, Complex n2)
              realPart = n1.get_realPart() * n2.get_realPart();
              imaginaryPart = n1.get_imaginaryPart() * n2.get_imaginaryPart();
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
              Screen.message("Number 1 is: " + realPart);
              Screen.message(" * " + imaginaryPart + "i");
              Screen.newline();          
              Screen.message("Number 2 is: " + realPart);
              Screen.message(" * " + imaginaryPart + "i");
              Screen.newline();
              Screen.message("-----------------------------------------------");
              Screen.newline(2);
    Any help greatly appreciated.
    Niall Magner

    There are several problems with this code. You never call the add method, so the numbers are never going to be added. You never load up a complex number to add either.
    Try doing something a bit more like this:
      read a float from the keyboard
      read another float from the keyboard
      Create a complex number from this float
      Complex complex1 = new Complex();
      complex1.realPart = first number from above;
      complex1.imaginaryPart = second number from above;
      do this again to get the second complex number
      then add the numbers together
      Complex complexSum = new Complex
      complexSum.addComplexNum(complex1, complex2)
      print complexSum.realPart + "+i" + complexSum.imaginaryPart;
      then do the other operations you wantI would also advise that you take a course in Java Programming, cos the code you have posted is truely awful.

  • How to convert a waveform signal into array of complex numbers

    How to convert a waveform signal into array of complex numbers.

    Hi Chaks,
    try this:
    (Get Waveform components, convert to complex DBL)
    Message Edited by GerdW on 01-28-2008 09:23 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    ToCDB.png ‏1 KB

  • Having trouble converting array to spreadsheet string, storing the file and coverting back to array with complex numbers

    I am working with a network analyzer. I have arrays made of 5 columns the first consisting of an integer and the next four consisting of complex numbers. I am converting the array into a spreadsheet string and then saving the file using the write characters to a file VI. That seems to work well as when I open the file in Excel all the data is there. However when I try to reverse the process, open file and convert back to array, I loose some of the data. Specifically the imaginary parts of my complex numbers are all going to zero. I have narrowed down the problem to be in the conversion from spreadsheet string to array and vice versa. I
    think the problem may be with the 'format' input to the VI. I do not have an adequate resource for this so I am not sure what to put in to accomplish my task. Any takers?

    Hi Biz
    I don't think there is a direct way of converting a complex number to a
    string, so when you convert the array to a spreadsheet string, the
    numbers would be converted to real data.
    However, you could try separating the real and imaginary parts using the
    "Numeric: Complex to Re/Im" function, and then store these - either in
    separate files or in adjacent columns/rows in the same file. Then, when
    you read in the data again, use the "Numeric: Re/Im to Complex" function
    to put the two "halves" together.
    If you actually want Excel to interpret the numbers as imaginary, then
    you'll probably want to create a string for each complex number of the
    form "Re + Im*i" (after separating the Re and Im parts), by using
    "String:Format into String" with 2 numeric inputs and the format string
    "%f+%fi".
    Reading the data back into Labview then would require splitting the
    string into the 2 pieces by using "Stringcan from String" with 2
    numeric outputs (smae precision as original numbers specified by the 2
    Default Value inputs) and the same format string "%f+%fi", and then using
    the above-mentioned "Numeric: Re/Im to Complex" function. It worked for
    me, so if you can't follow what I am describing, send me an email and I
    can email you what I did (LV 5.1.1).
    Paul
    Biz wrote:
    > Having trouble converting array to spreadsheet string, storing the
    > file and coverting back to array with complex numbers
    >
    > I am working with a network analyzer. I have arrays made of 5 columns
    > the first consisting of an integer and the next four consisting of
    > complex numbers. I am converting the array into a spreadsheet string
    > and then saving the file using the write characters to a file VI. That
    > seems to work well as when I open the file in Excel all the data is
    > there. However when I try to reverse the process, open file and
    > convert back to array, I loose some of the data. Specifically the
    > imaginary parts of my complex numbers are all going to zero. I have
    > narrowed down the problem to be in the conversion from spreadsheet
    > string to array and vice versa. I think the problem may be with the
    > 'format' input to the VI. I do not have an adequate resource for this
    > so I am not sure what to put in to accomplish my task. Any takers?
    Research Assistant
    School of Physiotherapy, Curtin University of Technology
    Selby Street, Shenton Park, Western Australia, Australia. 6008
    email: [email protected]
    Tel. +61 8 9266 4657 Fax. +61 8 9266 3699
    "Everyone who calls on the name of the Lord will be saved." Romans 10:12
    "For all have sinned and fall short of the glory of God, and are
    justified freely by his grace through the redemption that came by Christ
    Jesus." Romans 3:23-4

  • Tdms does not support complex numbers?

    I can see that I can create and manipulate complex waveforms in Labview, but when I try to save such a waveform in a TDMS file, I get a run-time error that data format is not supported, forcing me to split the complex waveform into two separate waveforms for saving.
    Also, when I send a complex waveform to a Waveform Graph indicator, it truncates the imaginary part.
    Are there any plans to add native support for complex numbers in TDMS and graphing?

    Fedor wrote:
    I can see that I can create and manipulate complex waveforms in Labview, but when I try to save such a waveform in a TDMS file, I get a run-time error that data format is not supported, forcing me to split the complex waveform into two separate waveforms for saving.
    That's correct. TDMS does not support complex values.
    Also, when I send a complex waveform to a Waveform Graph indicator, it truncates the imaginary part.
    That's also correct. Think about it. What would you plot on a waveform graph? You could use something like an XY graph, with X being the real values and Y being the imaginary values. Or, you could use a polar plot (available as a picture indicator plot).
    Are there any plans to add native support for complex numbers in TDMS and graphing?
    If you wish to make a suggestion regarding this, then you can post in the LabVIEW Idea Exchange, where people can vote on the idea. You may need to submit this as two different ideas since it's covering two different components.

  • Waveform and Complex Numbers

    Great; in LV 7.0 Complex Numbers were included as an allowed subtype of Waveform data.
    Bad; the vis supporting Complex numbers in Waveforms have a large number of errors. Many Vis does not handle complex numbers and therefore strip off the complex part at the output of the vi. I spent a lot of time to discover and correct the errors in the vis that I used.
    Are NI or anybody else working on a patch for these VIs (part of vi.lib)?

    You can let R&D directly know of these problems by going to www.ni.com >> contact NI >> feedback (bottom left). These reports go directly to the R&D managers. You can also contact tech support and have them file a report of the bad behavior. Be sure to provide example program and specific information.

  • Complex Numbers: better implementation

    I've already created a Complex class, with all the mathematical methods necessary. But I've seen at the Internet several attempts to do such classes, and one preferred to make a compiler that accepts complex as a primitive type. And he's right. Creating a class to represent the complex numbers takes too much memory and time only to store two doubles. Using C/C++, complex numbers could be made with structs, and a Complex class would be used to implement the necessary methods, wrapping the complex type, like Double wraps a double.
    So, I'd like to suggest a new type of class. This class would act like
    an C/C++ struct, being able to store only fields and constructors. I believe that this way would make it waste less memory, and enable faster use of this class. It would work like this:
    public value class complex {
      public double real;
      public double imag;
    public class Complex {
      public static final complex I;
      I.real = 0; I.imag = 1;
    }What do you guys think?

    Creating a class to represent the complex
    numbers takes too much memory and time only to store two doubles.If the only fields in the Complex object are two doubles, how much more memory does a Complex object take up? The methods would only appear in the Class object, not each Complex instance. Right?
    I guess you have one reference on the stack and two doubles on the heap, as opposed to two doubles on the stack and nothing in the heap.
    So, I'd like to suggest a new type of class. This
    class would act like an C/C++ struct, being able to store only
    fields and constructors. I believe that this way would
    make it waste less memory, and enable faster use of this class.At this point I wonder whether there'd really be a big memory savings, and whether it would be worth watering down the OOP-ness of the language.
    Defining a complex primitive is another issue.
    Issues like ordering and equality would seem to make the problem really...complex... Perhaps any choice for those issues would only satisfy a third of the interested parties, and any design would satisfy no one.

  • I have a personal itunes account with an iPhone5s and an iPad 4 mini. I have unlokced my old iPhone 4 to use for work on a diffeent SIM and new number, can i have all devices associated to me single appleID and use both numbers ?

    I have a personal itunes account with an iPhone5s (perosnal mobile numer) and an iPad 4 mini (no SIMM). I have unlocked my old iPhone 4 to use for work on a different SIM and new number,
    Do you know if I can have all devices associated to my single apple ID and still use both numbers without messing up my profile. It has just changed my number over.

    I would not be able to give you idiot proof guide, since different games are different. Some of them have icloud integrated already, but those already taken care of. Some of them use specific logins and once you log - you get your info. General recommendation is to contact support sites of those games for enabling icloud instructions or enabling of transfer. There are other purely apple ways - like sync your phone in itunes and then sync apps with ipad, but those are only one time transfer. There is another way that is not typically recommended - restoring ipad from iphone backup. It may transfer your game content, but once again sync in the future has to be done by game.
    So if I were you, I would address that individually with every game provider.

  • How to use different  numbers ranges in LSMW for a material in 8plants

    Hi all,
    I have to upload data using MM01 in LSMW by using external numbers.
    the MATNR for materials are like this 17240,22818,82618,487218,7218,26418
    how can i take these numbers in LSMW.i have 61 material numbers to be extended to 8plants.can i upload these material numbers at a time in LSMW
    the above material number should be extended to 8plants.but the field values for some fields are varying.the material number should be same for 8plants
    For this issue, which method i should follow in LSMW.

    Just do one thing,
    while recording enter the material numer field by yourself(Not blank).This material is the material which you mention out of 61,
    and upload the same in your upload file, and just change plant.i mean 8 records are there for each material( all 61)
    reward if useful.
    Amit Singla

Maybe you are looking for