In order to explain it, let's take an example from 'Hysteresis Comparator with Simscape Library' post.
Example: Hysteresis Comparator with Simscape Library |
The first think we should do is to convert the signals of interest into 'Test points'. This could be done by right-clicking the signal wire, and click 'Properties'. Also, in order to export the signal data, the 'Log Signal Data' option has to be enable too.
Signal Properties window |
Now, the schematic should look like that:
Schematic with test points |
Zoom in of signal wires |
Finally, the next sequeance of instructions will help us to get our signals in Matlab enviroment:
%Different models we have open in Simulink
>>gcs
%Simulate the model
>>sim(gcs): simula los
modelos.
%Get the signal output
>>MyOutput=get(logsout,’SignalName’)
>>MyOutput=get(logsout,’SignalName’)
>>MyOutput.Values
%plot signal values
>>plot(MyOutput.Values.Time,MyOutput.Values.Data)
>>plot(MyOutput.Values.Time,MyOutput.Values.Data)
In our example:
>> MyOutput=get(logsout,'voltage1');
>> MyOutput2=get(logsout,'voltage2');
>> plot(MyOutput.Values.Time,MyOutput.Values.Data,MyOutput2.Values.Time,MyOutput2.Values.Data)
With all that we get:Matlab plot |
Simulink plot |
Now, we have the Simulink model data into a Matlab variable and we can use all the Matlab functions to process this data.
No comments :
Post a Comment