Home Forums SYSTEM co-simulation with matlab

Viewing 3 reply threads
  • Author
    Posts
    • #16746
      zsliu
      Participant

      Dear all,

      I am a beginner with optisystem, especially for co-simulation with matlab. To understand details of cosimulation. I built sine wave generator with matlab component in optisystem. I havent figured out why it doesn’t work. the matlab code as following:

      OutputPort1 = InputPort1;
      As=1; % amplitude of sine wave
      fc=Parameter1*1e9; % sine wave with 15 GHz
      fs=Parameter2; % sample rate
      tw=Parameter0; % time window
      t=[0:1/fs:tw-1/fs];

      cs = length(t);
      sw = As*sin(2*pi*fc*t);

      for m=1:cs
      OutputPort1.Sampled.Signal(m) = sw(m);
      end

    • #16748
      zsliu
      Participant

      just to upload osd file. it maybe has problem to pass global parameters sample rate and time window to matlab. but even I used fs=640e9; tw=12.8e-9; the output is still null.

    • #16752
      zsliu
      Participant

      I have figured out. the code should be as following.
      As=1; % amplitude of sine wave
      fc=Parameter1*1e9; % sine wave with 15 GHz
      fs=Parameter2; % sample rate
      tw=Parameter0; % time window

      t=[0:1/fs:tw-1/fs];
      Time = t;
      cs = length(t);
      sw = As*sin(2*pi*fc*t);
      OutputPort1.TypeSignal = ‘Electrical’;
      OutputPort1.Noise = [];
      OutputPort1.IndividualSample = [];
      OutputPort1.Sampled.Signal = sw;
      OutputPort1.Sampled.Time = t;

      • #16756
        Damian Marek
        Participant

        Good job figuring it out! Could you attach the M-file as well, so if users come upon this post they can try it out?

        Thanks

    • #16765
      zsliu
      Participant

      Thanks. please file the attached for M-file.

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