LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Help abt LabVIEW MathScript

Hello Sreenivasulu,

I am not familiar with the Modulation Toolkit VIs, but it looks like the error you're seeing is due to an input providing values other than zeros and ones.  I looked at your btgen.m source code and the dec2bin function is a good first step.  However, this function returns a binary number represented as a string.  When you output X as a double array, you get the ASCII value for the string '0' and '1' (48 and 49, respectively).

The simplest way I can think of to convert between a string of 1's and 0's and a numeric representation is to create a boolean array in which an element is true if it equals the string '1.'  Then, when you output this array as a double, true is represented as 1 and false as 0.  This will give you an array of ones and zeros as desired.  For example,
Y = (X == '1');
Then output Y instead of X.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 21 of 27
(4,893 Views)
Hi Sir,
Thanks for your information.
i tried but i didn't get correclty.
i added a small for my btgen.m code
  if(X(var1)=='1')
                        Y(var1)=1;
                        if(X(var1)=='0')
                        Y(var1)=0;
i think this only you asked change.
please if u have time modify and send it ti me sir.


thanking you sir
0 Kudos
Message 22 of 27
(4,875 Views)
Hi Grant M,
I am Sreenivasulu.Here i have one issue on IQ data.
I am using Mathscript for generating some signal.This i downloaded into FPGA.below i am explianing what i did.

I am creating real data, data type double, and then converting it to a complex double.Then split out the real and imaginary arrays from the complex values.This complex signal i downloaded  into the FPGA as IQ data.I compared the real and imaginary arrays each to the original data double array.  When i do this, the values in the first array become the real values in the complex double array.  The imaginary parts of the array are all zeros.  When i split the complex array into its real and imaginary components, i have a real array identical to the original array, and the imaginary array of all zeros. I am not getting what i did mistake.

Actually why i came to know this is i am getting some phase changes.i am working last 10 days on this issue,today i came to know this problem.So please tell me sir how i can convert mathscript generated signal into complex signal.

Please help me sir
Thanking you sir

Sreenivasulu.O


0 Kudos
Message 23 of 27
(4,781 Views)
Hello,

if(X(var1)=='1')
>                        Y(var1)=1;
>                        if(X(var1)=='0')
>                        Y(var1)=0;

This code will work as well, but it will be much less efficient than the code I posted.  Also, you need an "end" statement at the end of each if statement.

I don't think I understand the problem you are asking about.  Everything looks good to me.  In the MathScript node, you have Fs (a real number), ts (a real number), Tb (a real array), and Fm (a real number coming from a DBL input).  In computing s1, you take the sine of a real array which produces a real array.  Then you output this real array from the MathScript node and convert it to a complex array.  When you split this complex array into real and imaginary parts, you see that the real part is the same as your original real array and the imaginary part is all zeros.  This is by definition what happens when you convert a real array to a complex array.

Then it seems like you send the complex array to the FPGA and examine the real and imaginary parts.  You note again that the real part is the same as the original real array and the imaginary part is all zero.  This is not a mistake.  This is expected behavior when converting a real number to a complex number.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 24 of 27
(4,769 Views)
Hi Grant M Sir,
Thanks for your reply.

I tried with same  code,but it is not working.Here i am sending some images and VI please work it and correct me.
Please  workout it sir.
                      if(X(var1)=='1')
                             Y(var1)=1;
                      end
                      if(X(var1)=='0')
                             Y(var1)=0;   
                      end
Regarding to complex signal conversion:
If i convert real array into complex i will get real value in real array and phase related array in imaginary array.i think i am correct.
But you are saying imaginary array will get zeros.How it?
I need to download only complex signal into FPGA.In this complex signal imaginary part became zero.where is the mistake,in mathscript node generation it self any mistake is there or where is the mistake.May be because of this only i am getting phase changes.

Please spend your some valuable time for me.
Here i am sending my project file also,if u need for clearing this issue please use it.

Thanking you sir.

Sreenivasulu.O

Download All
0 Kudos
Message 25 of 27
(4,757 Views)
Hello,

Your btgen code seems to work for me.  For example, in the MathScript Window, if I type
btgen('hello')
I get
[0 0 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 1]

As for the complex conversion, it seems like you want to do more than simply convert a real number to a complex number.  You mentioned you expect phase data in the imaginary array and you also mentioned IQ data before.  Unfortunately, I am not familiar with either one of these, but your MathScript looks good.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 26 of 27
(4,706 Views)
Hi Grant M,
thanks for your reply.
btgen is working fine.
but in complex conversion i have that same problem.now i am in different work.after trying if i get any problem i'll let you know.
ok sir byee

0 Kudos
Message 27 of 27
(4,665 Views)