Hi. Slow response because I forgot to add the thread to my watchlist. But thanks for helping.
"Bruno Luong" <email@example.com> wrote in message > > P_f = bsxfun(@times, W.^2, evals/(-N)); >
Thanks Bruno. Despite my sloppy code, I think you gave me what I need: bsxfun.
dpb <firstname.lastname@example.org> wrote in message <email@example.com>... > First, a couple of questions... > > a) The periodic solution as written will be N columns whereas the fixed > will be N-1. Is this intended/desired?
dpb: a) That is not what was intended. The fixed boundary code is not complete (hopefully this is the "untested code" Bruno was referring too) and should not have been included. Eventually, the fixed code will look something like
P_p = ([U(:,nPlusOne); 0]-U(:,n)).^2;
except that 0 will really have to be something like zeros(T,1). I'm working on the periodic code first and will come back to that.
dpb <firstname.lastname@example.org> wrote in message <email@example.com>... > b) As written the difference between n+ - n- of the array for periodic > will be that of column n minus n-2 rather than the "one on its right" > which implies a first difference. To illustrate if N were 5, say, the > two column vectors you generate are >
b) Are you talking about the code for P_p? I am subtracting the n columns from the n+1 columns (that is, u(n+1) minus u(n)). I think you read my code as u(n+1) minus u(n). I hope so, anyway. Because if you read my code right and you think it is doing u(n+1) minus u(n-1), then in trouble!
I think my code already does what circshift does, at least for the periodic case. diff seems to be more for taking derivatives, so I don't think it will help.
Sorry to all who read this for the sloppy code. I'm learning the math and matlab coding at the same time.