comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to give values as a range in array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to give values as a range in array? [message #93383 is a reply to message #93380] Tue, 28 June 2016 09:41 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, June 28, 2016 at 3:50:53 PM UTC+1, Meegle_Jade wrote:
> On Tuesday, June 28, 2016 at 7:32:54 PM UTC+5:30, Meegle_Jade wrote:
>> I need to fill an array with values say,0 to 100.Is there keyword to do that(without using any loops)?
>
> Infact, I need to plot flux values for frequencies ranging from 100GHZ to say 2000GHz . The frequencies need not be integers. I have IDL version 7. What to do?

I would expect that the frequency corresponding to each flux is in some data file and that you should use as an array. However, if you have to generate the frequencies, the exact command depends on what you want to achieve.
I would drop the "giga" and mention that on the axis so that you're plotting values between 100 and 2000 and the axis is something like "Frequency (GHz)".

How many values do you have and how are they spaced?
Lets say you have 201 values, then you need an array with 201 elements:
freq = findgen(201)
This is now an array like this: 0, 1, 2, ..., 199, 200
If these have to be spaced equally between 2000 and 100, then you have a delta of 1900/200=9.5. So you need to multiply the array freq by 9.5 and add 100:
freq = freq * 9.5 + 100
and you get an array like this: 100, 109.5, 119, ..., 1990.5, 2000.

I hope that makes sense.

Cheers
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bug in legend() for horizontal orientations
Next Topic: How to overplot in log scale?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:14:02 PDT 2025

Total time taken to generate the page: 0.00428 seconds