- This topic has 5 replies, 3 voices, and was last updated 8 years, 5 months ago by
mohammed hosni.
-
AuthorPosts
-
-
May 24, 2015 at 2:54 am #21105
Ajay Vyas
ParticipantHello
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’);
savePlease find attachment
Attachments:
-
May 25, 2015 at 11:59 pm #21149
Ajay Vyas
Participantok. I resend the code for MATLAB & project file. Please check it
-
June 14, 2015 at 12:57 pm #21689
mohammed hosni
Participant -
May 24, 2015 at 3:17 am #21107
-
May 25, 2015 at 9:47 am #21134
Damian Marek
ParticipantI 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 -
May 25, 2015 at 10:52 pm #21141
Ajay Vyas
ParticipantPlease 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’);
saveAttachments:
-
-
AuthorPosts
- You must be logged in to reply to this topic.