matlab code into pseudocode

Can somebody translate this following code into pseudocode (explanation in normal words what is done) as I am not familiar with matlab and I want to implement it in java.

for ii = 1:interval:len
SECTIONS(:,kk) = dividefreqs(Y(ii:ii+window-1).*hanw,FS).';
    kk = kk+1;

here especially I dont thet part Y(ii:ii+window-1).*hanw
is Y(ii:ii+window-1) iterating thorugh the array? and I read that if you multiply two arrays they have to have the same size but here "hanw" has size 16317 and window=512

and also this bit of code:

for ii = ssize(1):-1:2
    FREQDIFF(ii-1,:) = SECTIONS(ii-1,:)-SECTIONS(ii,:);

for jj = 2:ssize(2)
    SECDIFF(:,jj-1) = FREQDIFF(:,jj) - FREQDIFF(:,jj-1);

for ii = 1:ssize(1)-1
    for jj = 1:ssize(2)-1
        if SECDIFF(ii,jj) > 0
            SECBIGGER(ii,jj) = 1;
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The first for-loop will iterate ii from 1 to len with the interval. If interval is negative (as in your second loop) the iteration variable will decrease.

Then you should understand indexing of 2D matrices, like your SECTIONS variable. 1st index means rows, 2nd - columns. Single column symbol (:) means everything. So, SECTIONS(:,kk) means to get all rows in kk-th column (or columns since kk can be a vector in general). If you have only 1 index, it will return matrix elements as a column vector, indexing first all rows from the 1st column, then all rows from the 2nd column, etc.

.* means element-wise multiplication. You are right that variables on both sides of this operator have to be the same size. So, if windows =512, Y(ii:ii+window-1) will return a row vector of size 512. It cannot be multiplied element-wise with a vector of different size, you will get an error.

dividefreqs is a function, probably from some of your package. ' at the end means to transpose the function output to get a column vector.

For the 2nd loop:
ssize is probably 2-element vector of SECTIONS matrix size (rows,columns). ii starts from the number of rows, and goes down with every iteration (-1 interval). Actually this whole operation can be done without using for-loop:
    FREQDIFF = SECTIONS(1:end-1,:)-SECTIONS(2:end,:);
Here "end" means last element number, lasy row in this context.

Same for the 3rd loop, but now the columns get substracted:
    SECDIFF = FREQDIFF(:,2:end) - FREQDIFF(:,1:end-1);

Last nested loop also probably can be avoided, but I don't now the size of SECBIGGER. Do you have a line that creates this matrix or preallocate it?

To understand the code I'd advise to run it in debugging mode. You can then interactively check what different parts of code return.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.