programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# How is k=1:N expressed in JAVA

Greenhorn
Posts: 6
Hi,
How is k=1: (N+256)/2; expressed in Java.
k is the vector length.

Marshal
Posts: 57443
175
Welcome to the Ranch

What does that formula mean?

Elisabeth Ibeh
Greenhorn
Posts: 6
Thanks.
It is the length of the frequency vector.

Campbell Ritchie
Marshal
Posts: 57443
175
You have already told us that. How do you work it out? Does : mean divide?

Elisabeth Ibeh
Greenhorn
Posts: 6
means the the length starts from 1 to (N+256)/2
I am new to Java, usually work with Matlab.
any help will be appreciated. Thanks

Campbell Ritchie
Marshal
Posts: 57443
175
Afraid I am not familiar with that algorithm.
Sounds like something for a loop. In which case you might have multiple results and they will have to go into an N‑length array.

Bartender
Posts: 10575
66
• 1

Elisabeth Ibeh wrote:means the the length starts from 1 to (N+256)/2

Yes, but I think what's being asked is: what is N? For the purposes of the loop is it a constant, or can it change while the loop is in progress?

Either way, assuming that the loop is working with a counter, it could easily be something like:however, 'k' could just as well be a float or a double if you need it to be.

you should also understand the difference between integer and floating-point division, because if n (and in Java, by convention, it's 'n', not 'N') is an integer type, it will behave differently from if it's a floating-point type.

Winston

Elisabeth Ibeh
Greenhorn
Posts: 6
Thanks.

 permaculture is largely about replacing oil with people. And one tiny ad: The WEB SERVICES and JAX-RS Course https://coderanch.com/t/690789/WEB-SERVICES-JAX-RS