LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

difficut in designing some part of this MATLAB program in labview

Program of Transmitter (matlab)

 

clear        

clc

block=2;

n=1;                    %no.of users

m=2;                  %data length

sl=2;                 %spread length

chiplen=m*sl;        %chip length

itnum=30;

ebnostart=0;     %step iteration

ebnostep=3;

ebnonum=8;

 

%spreading sequence producing {+1,-1,+1,-1--------}

for i=1:sl

    spreading(1,i)=1-2*rem(i-1,2);

end

%spreading sequence generation ends

 

%interleaving sequence generation begins

for i=1:n

    for j=1:chiplen

        scrambrule(i,j)=j;

        first(i,j)=j;

    end

    for j=1:chiplen

        k=j+rem(randint(1,1,1000)*randint(1,1,1000),(chiplen+1-j));

        tmp=scrambrule(i,j);

        scrambrule(i,j)=scrambrule(i,k);

        scrambrule(i,k)=tmp;

    end           

end

%interleave design ends

 

%the simulation process begins

for z=1:ebnonum

    ebno=ebnostart+z*ebnostep;

    snr(z)=(10.^(ebno/10))/sl;

    sigma=sqrt(0.5/snr(z));

    error=0;

    for bloc=1:block

           

        %transmitter section begins

        %generation of data randomly

        for i=1:n

            for j=1:m

                data(i,j)=randint(1,1);

               

            end

        end

        %end of generation of data

      

         %data spreading begins

        for i=1:n

            l=1;

            for j=1:m

                tmp=1-2*data(i,j);

                for s=1:sl

                    chip(i,l)=tmp*spreading(1,s);

                    l=l+1;

                end

            end

        end

        %end of data spreading

      

       %transmitting data production begins

       for i=1:n  

           for j=1:chiplen

               transmit(i,j)=chip(i,scrambrule(i,j))

           end

       end

       %transmitting data produced

      %transmitter section ends

    end

end

0 Kudos
Message 1 of 10
(3,419 Views)

Hi dsk,

 

what do you expect here? Do you think someone will do your work? Come on...

 

You should:

- describe your problem more detailed

- attach, what you already converted to LabVIEW G

- tell us the LV version you're using

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(3,417 Views)

How to solve the problem:

  1. Create a new VI.
  2. Put the Matlab Script Node on the block diagram
  3. Copy and paste your Matlab code in the script node.
  4. Run.

There, problem solved. Oh, wait, that wasn't the question? Silly me.

 

Then perhaps you might want to look at this: http://www.catb.org/~esr/faqs/smart-questions.html

0 Kudos
Message 3 of 10
(3,409 Views)

 tmp=scrambrule(i,j);

        scrambrule(i,j)=scrambrule(i,k);

        scrambrule(i,k)=tmp;

in this how can inter change the vale for interleaver then this same problem is again data genration...

0 Kudos
Message 4 of 10
(3,382 Views)

You're on the wrong site. http://www.mathworks.com/ is where you go to get Matlab code debugged and written. 

0 Kudos
Message 5 of 10
(3,377 Views)

I can not transform these line in labview sir.

how does I transform/write/design block of these lines in labview.

0 Kudos
Message 6 of 10
(3,366 Views)

Hi dsk,

 

when you're not able to program a simple element swap of a 2D array in LabVIEW I would suggest to go through the basics course offered by NI:

check.png

 

One more (maybe more intuitive) way:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 10
(3,357 Views)

And sir these line are also creating problem to design(in above whole program)

          

for s=1:sl

                    chip(i,l)=tmp*spreading(1,s);

                    l=l+1;

                end

0 Kudos
Message 8 of 10
(3,343 Views)

Hi dsk,

 

spreading(x,y) is just a 2D array, which gets indexed with (1,s). The indexed value will be multiplied by "tmp" and then placed into the 2D array "chip" at index (i,l).

 

What part is it that is not solvable for you?

Is it the part of indexing an array?

Do you have problems in multiplying two values?

Don't you know how to use ReplaceArraySubset?

Or can't you increment some loop indices?

 

Come on, do some programming on your own...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(3,338 Views)

Still i have problem

for j=1:chiplen

        k=j+rem(randint(1,1,1000)*randint(1,1,1000),(chiplen+1-j));

        tmp=scrambrule(i,j);

        scrambrule(i,j)=scrambrule(i,k);

        scrambrule(i,k)=tmp;

    end           

0 Kudos
Message 10 of 10
(3,314 Views)