No it is not correct.
- There is already a dwt routine in one of the toolboxes. Calling your code dwt.m is at the very least going to be confusing, and could well interfere with other routines.
- code that starts with "clear all" is always broken.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!