- This topic has 6 replies, 2 voices, and was last updated 8 years, 5 months ago by Andres Triana.
-
AuthorPosts
-
-
July 4, 2016 at 7:12 am #40883Andres TrianaParticipant
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
-
July 7, 2016 at 10:09 am #40926Damian MarekParticipant
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.
-
July 7, 2016 at 3:01 pm #40928Andres TrianaParticipant
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.-
July 8, 2016 at 9:49 am #40929Damian MarekParticipant
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
-
July 8, 2016 at 4:33 pm #40931Andres TrianaParticipant
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,
-
July 11, 2016 at 10:52 am #40940Damian MarekParticipant
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
-
July 11, 2016 at 4:08 pm #40948Andres TrianaParticipant
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,
-
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.