Export data, view waveform and calculate power of Sinusoid in Simulink | applied electronics engineering

# Export data, view waveform and calculate power of Sinusoid in Simulink

By Applied Electronics - Wednesday, March 8, 2017 No Comments
In this 8th tutorial of Modeling digital communication systems using Simulink,we want to show how to export data, view waveform and calculate power of Sinusoid in Simulink.

A sinusoidal signal equation is as follows,

Now we want create this signal in simulink and analyze the signal properties both in matlab and simulink. For this we create the following simulink model for generating the sinusoid and observing its properties using time scope and display meter.

The sine wave is a wave of amplitude of 1, frequency of 1 and phase shift of 0. The properties can be set by double clicking on it and below is the setting:

How to create simulink model and place sine wave block and set the properties was explained in details in the first part of the tutorial Modeling digital communication systems using Simulink.

Similarly the To Workspace block is named as sine_out to retrieve values generated by simulation into Matlab Workspace. This block setting is shown below. Notice that here, the Save Format field is set to Timeseries in order to save the values in time series format, that is with amplitude values at sucessive time intervals.

We can view the data in the workspace and are shown in the figure below. There are 3 variables- data, sine_out and tout. The data and sine_out data are the same and are the amplitude of the sine wave at the sucessive sampling instant 0.05. The tout is just the list of the time series values.

Next we have the scope which displays the sinusoidal signal in time sampled at 0.05s as shown below.

See previous tutorial How to customize Scope in Simulink.

Next we have used the variance blocked named Running Var to calculate and display the average power as shown below. It calculates the theoretical average power of the sine wave which is 0.5 that is displayed in the display block.