Tutorial: How to create a waveform (.wv) file with Matlab

In this tutorial we are going to see how to create a waveform file by using Matlab and a free software from Rohde & Schwarz.
There you find:
  • iqDatasource.m
  • modulator.m
  • modulator.fig
Save them in the same folder. We will come back to what each file does, but now you need to download the software application that will allow you to create an analyze your waveform, the R&S ARB Toolboxhttps://www.rohde-schwarz.com/uk/applications/r-s-arb-toolbox-plus-application-note_56280-15443.html. Download and run the installation file that works with your O.S.
Once you’ve got those, let’s see how you can create your customized waveform:

Step 1:

In the file “iqDatasource.m” you create your desired signal. In the code available, we have created a BPSK constellation that contains pilots at the beginning of it. It is important to separate I and Q data as in the example (if you signal is real, you just need I data, and Q data is zero, as in the BPSK case).
In this example, “totData” represents the following frame structure:
Then, we need to separate the “inphase” and “quad” components, as it is done in the example.
Note that we have save the original data “randBits.mat” because you can also load your own data in the function and then the program makes the necessary arrangements for you. The only requirement of your data is that you need to have two rows: one for the I data and another for the Q data.

Step 2:

The file “modulator.m” applies an oversampling factor (“ovs”) of 4 and a sample rate of 22 MHz. Then, we apply a pulse shape with two filter possibilities: Gaussian or Root Cosine filter. These steps are customizable as well in the script.
In the same file, a .txt file is created and saved in the same folder as “iqDatasource.m”, “modulator.m”, and “modulator.fig”. This file and the way is created is something that you don’t want to modify, as it is the necessary file format that we need to input in the R&S ARB Toolbox. By the way, the “ARB” stands for “arbitrary”, which means, you can create any waveform you like 🙂
Then, there is a FFT calculation and some plots.
First, the applied filter (root cosine, in this case):
root cosine filter
And then your waveform in the time domain (with and without oversampling), the pulses and the spectrum:
modulator output
This is plotted by using the file “modulator.fig”.

Step 3:

Now, launch the R&S ARB Toolbox. You will see a pop-up giving an error about the VISA port: just click ok; this error comes because the tool can be used connecting your PC to a signal generator and load your waveform directly there, but for this tutorial, we will just work with our PC (don’t worry, no need for buying a signal generator :P):
ok visa
Then, in one of the file systems shown (in this case, they are both your PC, although it could be your PC and the signal generator file system), look for the generated .txt file:
Right panel
Select the file, right click on it and click Import –> Import Data: you will see a popup; click on next and make sure in the next screen you see this configuration:
popup next
This is important because it is consistent with the format of your .txt file. This is a preview of what you are doing:
Finally, select the same sample frequency as you put in “modulator.m”, the folder where you want to save the waveform (by default, it is the same as where it read the .txt file) click next and run:
Now, let’s have a look to the waveform. Close and open the R&S ARB Toolbox so the file system is updated and includes your waveform. Search for it, select it, right click on it and click in Analyze. Then, you can select Info to see the parameters or view, to see this:
analyze window
and that’s how it looks your customized waveform! Note that this process is specially useful if you want to load a customized modulation in a signal generator, as usually, the generators provide the standard modulation schemes, but sometimes you may want to add pilots, spread the symbols (as in our previous posts) and so on.
We would like to thank the Rohde and Schwarz technical staff for their support in this topic. We hope you enjoyed this tutorial 🙂

Add a Comment

Your email address will not be published. Required fields are marked *