create_H_matrix - Author Andrew Harms Date Copyright(c 2013...

This preview shows page 1 out of 1 page.

% Author: Andrew Harms % Date: 03/31/2013 % Copyright (c) 2013 by Andrew Harms. This work is made available under % the terms of the Creative Commons Attribution-ShareAlike 3.0 license function H = create_H_matrix(R,W) % Create summation-operation matrix (size R x W). If W/R is not an % integer, then split entries between rows. W and R should be integers. if W < R
Image of page 1

Unformatted text preview: error('Cannot use W < R'); else H = zeros(R,W); r=0; k=0; for i=1:R index1 = floor(W/R-(1-r)); next_r = round(W-R*index1-R*(1-r))/R; M = [(1-r) ones(1,index1) next_r*ones(1,next_r>0)]; r = next_r; H(i,:) = [zeros(1,k) M zeros(1,W-k-length(M))]; if r k = k + (length(M)-1); else k = k + length(M); end end % for end % if W < R end % function...
View Full Document

  • Fall '15
  • Ring, Lawrence Lessig, Andrew Harms, 2013 %

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern