Home Forums SYSTEM Output Port Define file

Output Port Define file

(joined April 2014)
Participant

Hello
O am working with Co simulation with MATLAB. It is one close loop system the input put signal & the feedback system is electrical domain & the output is also in electrical.
The modify input is inverse of feedback signal. I prepare the matlab code for it but some error to define the output portech it
Please check it
OutputPort1 = InputPort1;
% % SampledNumber = length(InputPort1.Sampled);
% % ParameterizedNumber = length(InputPort1.Parameterized);
% % NoiseNumber = length(InputPort1.Noise);
InputPort1=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,a1,’Time’,1.5938e-009),’IndividualSample’,struct);
InputPort2=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,a2,’Time’,1.5938e-009),’IndividualSample’,struct);
OutputPort1=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,c,’Time’,1.5938e-009),’IndividualSample’,struct);
% port1 = InputPort1.Noise.Signal;
% port2 = InputPort2.Noise.Signal;
% port3 = OutputPort1.Noise.Signal;
a1=InputPort1.Sampled.Signal;
a2=InputPort2.Sampled.Signal;
% OutputPort1.Sampled.Signal = c;
% a1=[1 2 3];
% a2=[4 6 5];
% c=real(c);
% d=InputPort4.Sampled.Signal;
% d=real(d);
save(‘input.mat’)
% b=inv(a1);
c=a2./a1;
OutputPort1.Sampled.Signal = c;
OutputPort1.Sampled.Signal= (InputPort2.Sampled.Signal./real(InputPort1.Sampled.Signal));
plot(‘InputPort2.Sampled.Signal’ , ‘InputPort1.Sampled.Signal’);
save

Please find attachment

Attachments:

Responses (5):

    • #21105
      Ajay Vyas
      Participant

      Hello
      O am working with Co simulation with MATLAB. It is one close loop system the input put signal & the feedback system is electrical domain & the output is also in electrical.
      The modify input is inverse of feedback signal. I prepare the matlab code for it but some error to define the output portech it
      Please check it
      OutputPort1 = InputPort1;
      % % SampledNumber = length(InputPort1.Sampled);
      % % ParameterizedNumber = length(InputPort1.Parameterized);
      % % NoiseNumber = length(InputPort1.Noise);
      InputPort1=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,a1,’Time’,1.5938e-009),’IndividualSample’,struct);
      InputPort2=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,a2,’Time’,1.5938e-009),’IndividualSample’,struct);
      OutputPort1=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,c,’Time’,1.5938e-009),’IndividualSample’,struct);
      % port1 = InputPort1.Noise.Signal;
      % port2 = InputPort2.Noise.Signal;
      % port3 = OutputPort1.Noise.Signal;
      a1=InputPort1.Sampled.Signal;
      a2=InputPort2.Sampled.Signal;
      % OutputPort1.Sampled.Signal = c;
      % a1=[1 2 3];
      % a2=[4 6 5];
      % c=real(c);
      % d=InputPort4.Sampled.Signal;
      % d=real(d);
      save(‘input.mat’)
      % b=inv(a1);
      c=a2./a1;
      OutputPort1.Sampled.Signal = c;
      OutputPort1.Sampled.Signal= (InputPort2.Sampled.Signal./real(InputPort1.Sampled.Signal));
      plot(‘InputPort2.Sampled.Signal’ , ‘InputPort1.Sampled.Signal’);
      save

      Please find attachment

      Attachments:
    • #21149
      Ajay Vyas
      Participant

      ok. I resend the code for MATLAB & project file. Please check it

    • #21689
      mohammed hosni
      Participant

      i think the attached file will help you

    • #21107
      Ajay Vyas
      Participant

      Please find the Optisystem file for co simulation

      Attachments:
    • #21134
      Profile Photo
      Damian Marek
      Participant

      I don’t understand your m file. It seems like you are overwriting the InputPort structure arrays with news ones by that variable declaration. You do not need to declare the InputPort variables they are already made and in the workspace. You only need to access the values from them.

      +1
    • #21141
      Ajay Vyas
      Participant

      Please find the new m file & .osd project file. Please check

      OutputPort1 = InputPort1;
      InputPort1=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,a1,’Time’,1.5938e-009),’IndividualSample’,struct);
      InputPort2=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,a2,’Time’,1.5938e-009),’IndividualSample’,struct);
      OutputPort1=struct(‘TypeSignal’,’Electrical’,’Sampled’, struct,’Noise’,struct(‘Signal’,c,’Time’,1.5938e-009),’IndividualSample’,struct);
      a1=InputPort1.Sampled.Signal;
      a2=InputPort2.Sampled.Signal;
      save(‘input.mat’)
      c=a2./a1;
      OutputPort1.Sampled.Signal = c;
      OutputPort1.Sampled.Signal= (InputPort2.Sampled.Signal./real(InputPort1.Sampled.Signal));
      plot(‘InputPort2.Sampled.Signal’ , ‘InputPort1.Sampled.Signal’);
      save

      Attachments:

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