- This topic has 42 replies, 11 voices, and was last updated 8 years, 5 months ago by Damian Marek.
-
AuthorPosts
-
-
February 22, 2016 at 6:50 am #29867love kumarParticipant
i have few query for matlab co simulation
1.I am running a matlab co simulation but getting error on line 1 as in ”inner metrix dimension must agree ” i am anot getting what is meaning of this error and how to remove.
2.Is it possible to remove input port (zero inputport) of because in my project i only need output data which will be generated by matlab itself without any input data. if i am using null point as input signal than simulation giving error as no input signal.
3. if i am using my script asOutputPort1 = InputPort1;
if(InputPort1.TypeSignal == ’Electrical’)
cs = length(InputPort1.Sampled);
if( cs > 0 )
abc = round(rand(1,1000));
OutputPort1.Sampled.Signal = round(rand(1,1000)) ;
end
end;thn i am getting error : time in OutputPort1.Sampled[1]
how i can handle this problem.
please help me.
-
February 22, 2016 at 7:18 am #30006alistuParticipant
Hi love,
Can you please attach your .osd file along with the Matlab file if it is possible? If you are using null as input to your Matlab component, you sould find a way to create the output vectors which are normally created by the code “OutputPort1=InputPort1;” always suggested by Optiwave to be used as the first line of the Matlab program.
Regards
-
March 8, 2016 at 1:33 pm #31940love kumarParticipant
could you suggest me how to define output vetcor.
-
March 8, 2016 at 1:47 pm #31944Aabid BabaParticipant
hello love kumar,
i think you are making a typiing error . You are using inverted parenthesis instead of ‘Electrical’. try this one.Regards
-
March 8, 2016 at 3:47 pm #31956love kumarParticipant
hi aabid baba .. as per your sugesstion i have changed the typing mistake but getting same error ..
-
March 8, 2016 at 10:30 pm #31960Aabid BabaParticipant
hello kumar,
Can you please upload the screenshot of the simulation tab when the error occurs because it shows you the message in the simulation tab where the error is. That may be someone could help in that regard. The matlab code just seems pretty much okay to me. Anyways try to upload the screenshot.
Regards
-
-
March 9, 2016 at 4:35 am #32019burhan num mina llahParticipant
Hi Love Kumar
Can u please provide the m file along with the osd file so that it becomes easier for us to help u. Matlab code seems fine. and regarding input to matlab component u cannot just keep the input null. u need to feed it with some input which it will process to give u the output. we cannot generate a signal as such in Matlab component as i was facing the same problem in my code.
Regards
Burhan
-
March 9, 2016 at 11:41 am #32089Aabid BabaParticipant
Hello burhan num mina llah,
I remember that you had a problem with co simulation too but in this case i feel it is an issue regarding proper interfacing thing between MATLAB and optisystem. The code that he has compiles should work fine because its a basic program. I feel he must be doing some wrong in interfacing and then getting signals out of the MATLAB module.
-
-
March 9, 2016 at 12:07 pm #32100SAHIL SINGHParticipant
hello kumar,
I suggest you to first upload the screenshot of the simulation tab when the error occurs in your design.Also as mentioned by Burhan provide the m file along with the osd file so that it becomes easier for us to help u.Regards
Sahil Singh-
March 9, 2016 at 12:18 pm #32106Aabid BabaParticipant
yeah sahil and burhan are right. You should upload the m.file along with the osd file of your system design so that it becomes convenient for us to figure out where the problem lies.
anyway looking forward for the upload.
Regards
-
-
March 11, 2016 at 12:44 am #32427FAYIQA NAQSHBANDISpectator
Hi.
Can u plz upload the snapshot of the window that shows the error. It is convenient to diagnose the problem. The code seems to be ok…
upload the m.file and the osd file…both
thanks and regards -
March 12, 2016 at 12:18 am #32518burhan num mina llahParticipant
Hi All
Yes Aabid i also think he has the problem in the interfacing part. I believe he might not be able to interface it correctly. Anyways Kumar i would suggest that when u double click on Matlab component Provide the path in the option Mentioned and then mention the m.file name seperately and do remember to mention the name followed by semicolon as it takes it as a command and then only it processes it and don’t forget to load the matlab component. I hope u are doing it acoording to these steps and i hope it should work . Else i would still suggest to please upload the .m file and .osd file, that would be helpfull to understand ur query.
Best Regards
Burhan
-
March 17, 2016 at 4:27 pm #33051love kumarParticipant
hi all… thanks for your suggestions.. what i have analysis the problem i mention was in code .. i resolved that problem .. but to interfece that code with matlab component i have to define phase of sine genrator in radian… is there any option .. the change is n=code is explaed with a example
matlab we take as
a= rand(1,1000);
x= -pi:0.01:pi;
sin(x)*a
getting error with this codebut
we have to take it as
a= rand(1,1000);
x= -0.0034:0.01:0.0034;
sin(x)*awe have to set vale of x in sine generator… how cud we do it
-
March 18, 2016 at 2:42 am #33061FAYIQA NAQSHBANDISpectator
HI LOVE KUMAR
Burhan num can help you over this..if the problem is lies with interface she can definitely help you..but what i see her is that you are facing an issue with conversions…as mentioned in your recent post over the same query . I would like to suggest u to change the phase into radains in the MATLAB code itself if possible…may be that wud help..
Thanks and regarrds
-
-
March 21, 2016 at 5:11 am #33436burhan num mina llahParticipant
Hi All
Love kumar if you have any query regarding interfacing your matlab code with optisystem i can surely help you out but writing a matlab code or removing errors would be difficult for me i would suggest u to ask this query to some coding expert. As it is quite cumbersome to design a code and that too a code that u need to interface with optisystem. Surely u can inform me about the interfacing issue. Happy to help.
Regards
Burhan
-
March 21, 2016 at 7:31 am #33448love kumarParticipant
hi burhan … i m attaching there the file .osd, mfile and snapshot of error please find he attachment here with … i just want a output at the mz modulator and Matlab component …kindly provide me the solution .. just a sine signal need to b multiply with a random number ..
-
March 21, 2016 at 7:48 am #33457burhan num mina llahParticipant
Hi Love Kumar
Actually this time i am not having access to the software i would try having a look at the matlab component interfaced tomorrow. I did see your code . It seemed ok but it is some problem in the code itself as i was able to see the screen shot and m. File only. I would be able to suggest further after having a look at your model.
Regards
Burhan
-
March 21, 2016 at 11:12 am #33472love kumarParticipant
hi burhan … i have attached the matlab code with the file name as test1.m in my last last … looking for a psotive response from your end ..
-
March 21, 2016 at 11:53 am #33477burhan num mina llahParticipant
Hi love kumar
Since i am not able to view ur design or model yet(no access to license) i cannot infer what is the input u have provided to the matlab component. I can only see your m.file and the screenshot and from that i can say as it clearly mentions that the input signal is not what your program demands. Can u brief me about that or i would suggest wait till tomorrow i will try to help u out. And can u please tell me where did u find this code from or u wrote it urself.
Regards
Burhan
-
March 21, 2016 at 12:02 pm #33479love kumarParticipant
i have written this code … n i was not getting any other suitable electrical component for input to matlab function.. waiting for tomorrow
-
March 21, 2016 at 12:32 pm #33482burhan num mina llahParticipant
Hi love kumar
So far i know about the code it seems quote ok but i believe there is some problem in the input you are providing to the matlab component. Let me check it tomorrow. I can assist u further afer that only. Till then may somebody else came up with a solution. Hope!
Regards
Burhan
-
March 22, 2016 at 2:18 am #33525love kumarParticipant
uplaoding .osd file again…
-
March 22, 2016 at 5:11 am #33532burhan num mina llahParticipant
Hi Love Kumar
Can u please upload a screenshot of ur .osd file or i would say the design/model.
Regards
Burhan
-
March 22, 2016 at 6:44 am #33534MHD NAParticipant
If you are using null as input to your Matlab component, you sould find a way to create the output vectors which are normally created by the code “OutputPort1=InputPort1;” always suggested by Optiwave to be used as the first line of the Matlab program.
-
March 22, 2016 at 6:55 am #33536love kumarParticipant
hi burhan … i am attaching the snapshot of the system ..
-
March 22, 2016 at 6:59 am #33538love kumarParticipant
hii MHD.. i ma agree with you .. but i m not getting the way how to define output vector .. if we use null as input signal .. if yu have any information please share ..
regards
-
March 23, 2016 at 2:37 am #33582Sanjeev kumarParticipant
Hello Burhan,
I was going to demodulate a CPFSK signal using matlab component as there is not any component available to demodulate CPFSK data. how can we demodulate it. or how can we get output as binary from input as CPFSK data. can you help me over this? Also i am attaching here .m file where i was going to construct an MSK modulator. once i able to complete it i think it would not be impossible for me consturct CPFSK demodulator too. the attached files are as one for optisystem other is msk modulation in matlab only. how can we run optisytem matlab code by using same parameters as matlab only file.
thank you. -
March 23, 2016 at 10:05 am #33613SAHIL SINGHParticipant
Hello Burhan,
I too have this query that how can we run optisytem matlab code by using same parameters as matlab only file… It seems that you have a lot of knowledge on the aforementioned topic… Hope to hear from you soon..
Regards
Sahil Singh
-
March 24, 2016 at 8:15 am #33696burhan num mina llahParticipant
Hi love kumar
I am not able to understand why this matlab component is showing error regarding the input port . It seems quite fine. I would suggest u to write this code i mean copy paste n save it again at some different place and give a new path. I hope it should work.
As such I can’t see any problem with design and code.Regards
Burhan
-
March 24, 2016 at 8:20 am #33701Naazira BadarParticipant
Hi all.
Yes , Burhan has explained every thing right in an elaborative manner.
That is the way to go about it.
And she’s right we can’t keep the input set to null. That should be taken care of.Regards
Naazira. -
March 24, 2016 at 8:23 am #33703burhan num mina llahParticipant
Hello sanjeev kumar
As of now i am not an expertise in coding but regarding the simulation of matlab code in optisystem you just need to keep in mind the signal types and sampled lengths. Else the matlab code follows the similar logic as in the matlab software itself. The major difference in the code for optisystem is we define ports with the same name as in optisystem and that is e.g InputPort keeping in mind tha caps as well. Rest for coding a demodulator i am sorry I don’t have much knowledge of coding. But since u have coded modulator it should be easy for you to design demodulator. Best of luck!
Regards
Burhan
-
March 24, 2016 at 8:26 am #33705burhan num mina llahParticipant
Hello sahil singh
I hope you got the answer for your query from my comment for sanjeev kumar that except for few things like signal type , sampled length etc. and mentioning the ports correctly, rest the code doesn’t follow some other logic . It is same as in the matlab software itself without much difference.
Regards
Burhan
-
March 24, 2016 at 9:40 am #33714SAHIL SINGHParticipant
Hello Burhan,
I thank you for explaining every thing right in an elaborative manner…. Indeed i got my answer… Indeed this information will be very helpful… Really appreciate your efforts…
Regards
Sahil Singh
-
March 24, 2016 at 12:44 pm #33733Sanjeev kumarParticipant
Yes definitely i know that burhan means we should keep in mind about the terms to be used as parameters in matlab co simulation. can we demodulate CPFSK and MSK data using PSK sequence decoder.?
-
March 24, 2016 at 4:33 pm #33756love kumarParticipant
hi burhan .. i did it many time as you suggest to cretae a new m file .. but unfortunately i get same error every time.. i m too much confused why this is happening ..i did other matlab co simulations also but hey are working fine ..
-
March 25, 2016 at 3:16 am #33801burhan num mina llahParticipant
Hi All
you are most welcome sahil singh
@sanjeev kumar.. you are welcome and it feels nice that i proved to be helpfull for you people. and regarding your query now. i very much believe that if you had been able to code the modulator then certainly there should not be any issue in redesigning the modulator i mean coding it. but since u are asking that u would decode that with PSK sequence decoder, i would say no just try to go for the matlab again as u have modulated with a different modulator so u should decode with a corresponding decoder/demodulator.Regards
Burhan
-
March 25, 2016 at 3:23 am #33804burhan num mina llahParticipant
Hi Love Kumar
i am really sorry that i can’t help u in this i have put forth all i knew about this matlab co-simulation.Since matlab in itself is a vast field and coding is really a difficult thing for a commoner like me . i only have the basic knowledge of matlab and on that basis i seemed to believe that your code is right but may be there would be some problem while interfacing it with the software (optisystem). it shows problem in the incoming signal so u can also try it with some other electrical signal.
Regards
Burhan
-
March 25, 2016 at 2:32 pm #33868love kumarParticipant
hi burhan .. first of all thanks for spending your time on my problem .. burhan do we have any possibility in matlab component that we can define struct for input and output signal according to our requirement … i am guessing that that may b helpful to solve this issue
-
March 26, 2016 at 3:13 am #33882burhan num mina llahParticipant
Hi love kumar
ohhhh yeah we can definitely define the type of signal it takes in the matlab component. u just have to double click on the componet and there is an option to even change the number of inputs and outputs and just below that there is mentioned what type of signal it takes and there are 4 options..electrical, binary, m-array and optical. u can keep any of these and likewise should be the code. if for example your code does not deal with the type of signal you will keep as input then please keep in mind that ur matlab component would be simulated without showing any error. so make sure that the code u have inserted is working by comparing your results without the matlab component also. hope it helps.
Regards
Burhan
-
March 27, 2016 at 3:22 am #33953love kumarParticipant
hi burhan.. i ii totatlly agree with you.. but my mean to say was can we change teh struct of input output strcut.. as we all know that matlab work on matrix structure..i an guess that outport of the matlab componet give result in 1×1 structure .. event in documentation in the matlab co simulation they had pointed about array structure .. even whn to write OutPort1= InputPort1: in matlab i starting creating a structure …do we have any option to define it according to our requirement
-
March 27, 2016 at 2:39 pm #33969burhan num mina llahParticipant
Hi Love Kumar
I understood your point and i know what you are referring to . Look the command that outputport 1 = InputPort 1 is written by default at the beginning as we want the incoming signal to pass to the output and regarding you type of signal issue the thing is that when you write a program you obviously write a code accordingly in or to get the required type of signal at output. And when we load the matlab file it automatically updates the type of signal in the code itself provided the code is valid and makes sure about the type of signal. Its all within the code and as such u need not make changes and even if u want to u still can.
Regards
Burhan
-
May 23, 2016 at 3:17 am #39331JamalParticipant
As you have quite a lot idea of matlab interfacing, I’d be pleased if you could help me with the interfacing.
I have initialised my output with OutputPort1 = InputPort1; and after doing all the work on the input signal I want to assign it to output.
I end the code with OutputPort1.Sampled.Signal = InterleavedSignal
In matlab after this assignment, I can successfully plot the OutputPort1.Sampled.Signal but the signal does not show up back in optisystem-
May 25, 2016 at 8:50 am #39377Damian MarekParticipant
Next time if you have a new question please start a new topic! Without your project file or matlab file I can only guess at the problem, but I do believe it is because your output port is not of the correct type. In OptiSystem, open the Matlab component and go to the Outputs. The type of the output should be set to either electrical or optical depending on what it is you are doing.
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.