added H matrix creation
updated main.m