Home Forums SYSTEM error when using matlab component

error when using matlab component

Profile Photo
(joined November 2015)
Participant

Hi,
I have to use optisystem matlab cosimulation to study underwater optical wireless communication. To learn the use of matlab component in optisystem I used the tutorials and application notes provided by optiwave. I don’t understand why I always get this error in matlab when trying those examples. —
Undefined function or variable ’InputPort1’.
Error in binaryxor (line 4)
OutputPort1 = InputPort1;

Also it shows a warning while calculating the matlab code in optisystem compilation and I don’t get any outputs. Could anyone please help me with this?

Responses (20):

    • #27745
      Profile Photo
      Radhika Raghavan
      Participant

      Hi,
      I have to use optisystem matlab cosimulation to study underwater optical wireless communication. To learn the use of matlab component in optisystem I used the tutorials and application notes provided by optiwave. I don’t understand why I always get this error in matlab when trying those examples. —
      Undefined function or variable ’InputPort1’.
      Error in binaryxor (line 4)
      OutputPort1 = InputPort1;

      Also it shows a warning while calculating the matlab code in optisystem compilation and I don’t get any outputs. Could anyone please help me with this?

    • #27792
      Profile Photo
      alistu
      Participant

      Hi Radhika,

      This error occurs when you have addressed a vector in your Matlab program that does not exist. I suggest that you upload the Matlab codes along with the osd simulation file here so it can be checked. (BTW, sometimes, when you correct an error in a Matlab program and run the simulation again, the same error will be given even though there is no error in the program. For that, you have to reopen OptiSystem and proceed with your simulation.)

      Regards

    • #27938
      Profile Photo
      Damian Marek
      Participant

      To help you we really need the matlab file and a screenshot or OptiSystem project file. I would guess you are using some command on line 1-3 which deletes all the variables like “clear all” or “clearvars”. Either that or the component is not connect properly.

      Regards

    • #28180
      Profile Photo
      Radhika Raghavan
      Participant

      Hi Alistu and Damian,

      I hadn’t opened the m file from code directory in matlab command window. Fixed it. Thank you.

    • #28183
      Profile Photo
      Radhika Raghavan
      Participant

      I am using Reed Solomon encoding and decoding with on off keying for underwater optical wireless communication system. Input is given using user defined bit sequence generator. When I input a 20 bit sequence directly, it showed a CIDF scheduler error and then I used the load from file option. For encoding I used matlab component. The matlab code worked when I run it separately with input given directly in matlab. But it does not work with the ‘InputPort1.Sequence’, which is actually the output from user defined bit sequence generator.
      For decoding, I have to convert electrical signal from detector output to binary and then decode using matlab component. Is there any way to convert electrical signal to binary in Optisystem 7.0 ?
      The files are attached.
      Can anyone help me to fix this issues?

      • #28194
        Profile Photo
        alistu
        Participant

        Hi Radhika,

        When I ran the above osd file, I got an error stating there is something wrong with the way you have used Matlab “reshape” function, which is related to your “rsecnoder_ook” program and the first Matlab component. So I think you should do something about it first to be able to have signals after that block.

        Regards

    • #28201
      Profile Photo
      Radhika Raghavan
      Participant

      Hi alistu,

      I could fix that error. The sequence length in layout properties was 32 bits and my input was 20 bits. So input was taken as 32 bit by default. That caused a mismatch in number of elements when I used reshape function.

      Is there any way to convert electrical signal to binary in Optisystem 7.0 ?

      • #28203
        Profile Photo
        alistu
        Participant

        I’m glad to hear that. Unfortunately, I don’t have access to OptiSystem version 7, but I believe you can do it by using M-ary threshold detector and setting its threshold levels to just one threshold and define two signal levels for it; one and zero (the same as the signal levels in a binary signal).

    • #28209
      Profile Photo
      Radhika Raghavan
      Participant

      Hi Alistu,
      Thanks a lot. I could convert the noise plus signal output of detector to an electrical pulse having 0 and 1 amplitudes. Still I have to convert the electrical signal to a binary sequence.

      • #28210
        Profile Photo
        alistu
        Participant

        You’re welcome. I don’t know any component to do this for you. However, I proposed a way of doing it a while ago that worked for members. You can follow the discussion and my below answer in the addressed topic:

        How to convert M-ary sgnal to binary signal

        Regards

    • #28229
      Profile Photo
      Radhika Raghavan
      Participant

      Hi Alistu,

      I will try it. Thank you.

    • #28253
      Profile Photo
      Radhika Raghavan
      Participant

      Hi,

      I used a M-ary threshold detector at the output of photodetector and a PAM sequence decoder to get the binary sequence. What I get at the output of PAM sequence decoder is a 160 bit long series of alternate 1 and 0s. This shouldn’t be the sequence I get for the given input. I think there is some problem with the PAM decoder. I have attached the osd file. Can you please check it and give some suggestions?

      • #28260
        Profile Photo
        alistu
        Participant

        I do not see the attachments. I will be waiting for you to attach the file. Maybe there is something wrong with layout settings (such as the bit rate being chosen as a number that the doesn’t match the one in user defined bit sequence if it has been used for example), but I can say for sure after I see the implementation.

        Regards

    • #28299
      Profile Photo
      Radhika Raghavan
      Participant

      Sorry. Here is the .osd file.

      • #28301
        Profile Photo
        alistu
        Participant

        Since you have made some changes in the formerly used Matlab codes to correct the cause of the “reshape” problem, I am not able to get any signal at the output as I am using the old Matlab files that you had uploaded here a few days ago. So can you please upload the corrected Matlab files here?

        Regards

    • #28302
      Profile Photo
      Radhika Raghavan
      Participant
      • #28335
        Profile Photo
        alistu
        Participant

        I have attached a file in which I have corrected the values of PAM decoder and M-ary threshold. Please notice the changes I have made to these components (and I don’t know if the whole scheme works fine), but do not continue your work on this implementation, as I have made other unnecessary changes to it. BTW, the “reshape” error was given for RS decoder component.

    • #28483
      Profile Photo
      Radhika Raghavan
      Participant

      Thanks a lot Alistu

      • #28492
        Profile Photo
        alistu
        Participant

        You’re welcome.

        Regards

    • #28696
      Profile Photo
      Radhika Raghavan
      Participant

      Hi Alistu,
      I could fix that problem by replacing M-ary threshold detector and PAM decoder by data recovery. Before that I was not getting a valid output sequence to decode.
      I get the correct input sequence I transmitted after decoding but the BER is 0. Can you tell me why this happens?

      • #28706
        Profile Photo
        alistu
        Participant

        Hi Radhika,

        BER being zero means data transmission in your system is done without any problem. It shows your system has a good quality. However, you can further increase the reach and/or bit rate to the point where BER reaches 1e-12 to 1e-9 (acceptable values for many practical communication systems).

        Regards

Login You must be logged in to reply to this topic.