We do not know what the sizes of X2 and twoHZ are, or how they are constructed.
All we know from the error message is that X2 and twoHZ are different sizes.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!