This section takes you through the features of one-dimensional extension or truncation using one of the Wavelet Toolbox™ utilities.
The function wextend performs signal extension. For more information, see its reference page.
From the MATLAB® prompt, type
The Wavelet Toolbox Main Menu appears.
Click the Signal Extension menu item.
From the File menu, choose the Load Signal option.
When the Load Signal dialog box appears, select the MAT-file noisbloc.mat, which should reside in the MATLAB folder toolbox/wavelet/wavedemo. Click the OK button. The noisy blocks data is loaded into the Signal Extension tool.
Enter 1300 in the Desired Length box of the extended signal, and select the Left option from the Direction to extend menu. Then accept the default Symmetric for the Extension mode, and click the Extend button.
The tool displays the original signal delimited by a red box and the transformed signal delimited by a yellow box. The signal has been extended by left symmetric boundary values replication.
Select the Both option from the Direction to extend menu and select the Continuous option from the Extension mode menu. Click the Extend button.
The signal is extended in both directions by replicating the first value to the left and the last value to the right, respectively.
Extending Signal for SWT
Since the decomposition at level k of a signal using SWT requires that 2^k divides evenly into the length of the signal, the tool provides a special option dedicated to this kind of extension.
Select the For SWT option from the Extension mode menu. Click the Extend button.
Since the signal is of length 1024 = 2^10, no extension is needed so the Extend button is ineffective.
From the File menu, choose the Example Extension option and select the last item of the list.
Since the signal is of length 1000 and the decomposition level needed for SWT is 10, the tool performs a minimal right periodic extension. The extended signal is of length 1024.
Select 4 from the SWT Decomposition Level menu, and then click the Extend button. The tool performs a minimal right periodic extension leading to an extended signal of length 1008 (because 1008 is the smallest integer greater than 1000 divisible by 2^4 = 16).
Select 2 from the SWT Decomposition Level menu. Since 1000 is divisible by 4, no extension is needed.
The same tool allows you to truncate a signal.
Since truncation is not allowed for the special mode For SWT, select the Periodic option from the Extension mode menu. Type 900 for the desired length and press Enter. Click the Truncate button.
The tool displays the original signal delimited by a red box and the truncated signal delimited by a yellow box. The signal has been truncated by deleting 100 values on the right side.
This tool lets you save the transformed signal to disk. The toolbox creates a MAT-file in the current folder with a name you choose.
To save the transformed signal, use the menu option File > Save Transformed Signal. A dialog box appears that lets you specify a folder and filename for storing the image. Type the name tfrqbrk. After saving the signal data to the file tfrqbrk.mat, load the variable into your workspace:
load tfrqbrk whos