Home Forums SYSTEM using multiple Matlab component blocks, input duplicated?

Viewing 2 reply threads
  • Author
    Posts
    • #40883
      Andres Triana
      Participant

      Hi all,

      Im getting a problem with matlab and optisystem cosimulation, what Im trying to do is to concatenate 2 ‘Matlab Component’ blocks.

      First, I generate a particular signal which I export from the first block, then I multiply in Optisystem and this product should be the input for the second Matlab block.

      when I do this, the InputPort1, goes from a length of 8192 to 16384, so Im thinking that maybe the input is overwriting when I use the second block.

      Is there any way to assign different names to the input and output pins of the Matlab component? or can anyone please suggest a solution?

      Im attaching osd file for illustration

    • #40926
      Damian Marek
      Participant

      I don’t have the m-files so I can’t say for sure, but I believe there might be an error with the matlab files you have. The sample rate should not change by itself when a signal is passed through an m-file.

    • #40928
      Andres Triana
      Participant

      Hi Damian, I think Im treating properly the signals in the m-files, in fact, using just one Matlab structure there is no problem at all.
      I guess that optisystem calls the two scripts at the same time, and since the variable ‘InputPort1’ is used by the two scripts, it probably is overwriting the variable.

      • #40929
        Damian Marek
        Participant

        I would be very surprised if that were the case because I have run these types of simulations before with multiple Matlab files and they have worked for me. If that were the case then the InputPort1 variable would be overwritten, but it should be overwritten with at least the same number of samples, unless of course one of the m files is increasing the number of samples somehow.

        Have you tried using both m files as individual components and see if one of them doubles the samples?

        Regards

        • #40931
          Andres Triana
          Participant

          Yes Damian, I have simulated each matlab component independently without seeing neither the inputport1 nor the outputports duplicated in length, however when I concatenate the two components The Inputport1 appears to be duplicated, Im sending attached files in case you want to run the simulation or give a look to the mfiles, maybe Im doing something wrong in there.

          thanks,

        • #40940
          Damian Marek
          Participant

          I tried it out and ran into a few problems. I found that the up sampled signal begins after the optical multiplier regardless of whether both or only the first matlab file is included. Thus, I think the problem lies with the first Matlab component. I found that in the two outputs of your matlab component the first port is just a straight copy of the input, so it should be fine. However, the second port is modified and furthermore has a different set of sampled frequencies. Although the same total number of samples, the underlying frequencies are different. I think this is where the problem lies.

          Is it possible to output the second frequency signal on the same “grid” of frequencies as the first output port? I think the problem lies in generating the frequency variables when OptiSystem expects that these values are untouched.

          Regards

        • #40948
          Andres Triana
          Participant

          Yes Damian, thanks so much, effectively the frequency vectors were different and that’s the origin of the problem, I was only paying attention to the number of samples. I’ll re-shape my signals and everything should now be ok.

          thanks again for your time,

          best,

Viewing 2 reply threads
  • You must be logged in to reply to this topic.