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

Home » Public Forums » archive » Re: How to produce N members between a and b with a determined spacing?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: How to produce N members between a and b with a determined spacing? [message #68574] Mon, 16 November 2009 07:05 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ali mozafari writes:

> Thank you David. How if we don?t know (b). I mean producing N numbers
> with Spacing (s) and initial number (a).

And, if you wanted to N numbers between A and B:

numbers = Scale_Vector(Findgen(N), a, b)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: How to produce N members between a and b with a determined spacing? [message #68575 is a reply to message #68574] Mon, 16 November 2009 07:02 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ali mozafari writes:

> Thank you David. How if we don?t know (b). I mean producing N numbers
> with Spacing (s) and initial number (a).

numbers = Indgen(n) * spacing + a

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: How to produce N members between a and b with a determined spacing? [message #68576 is a reply to message #68575] Mon, 16 November 2009 06:52 Go to previous messageGo to next message
a.mozafari1211 is currently offline  a.mozafari1211
Messages: 16
Registered: February 2009
Junior Member
On Nov 16, 6:43 am, Steve Eddins <Steve.Edd...@mathworks.com> wrote:
> ali mozafari wrote:
>> Hi there
>> I need to produce N members between a and b with a determined spacing.
>> In MATLAB it is work like this:
>> Data=a:spacing:b
>> How can we do this in IDL?
>> Any help highly would be appreciated
>> A.
>
> If you specify both N and the spacing then you've overconstrained your
> problem.  The MATLAB syntax you gave spacing the spacing but not N.
> This MATLAB function call specifies N but not the spacing:
>
> Data = linspace(a, b, N);
>
> If you really want to specify both N and the spacing then the last
> element of Data might not be exactly b.
>
> Say which one you want and then the IDL folks here can tell you how to
> do it.
>
> ---
> Steve Eddinshttp://blogs.mathworks.com/steve/

Thank you David. How if we don’t know (b). I mean producing N numbers
with Spacing (s) and initial number (a).
A.
Re: How to produce N members between a and b with a determined spacing? [message #68715 is a reply to message #68574] Tue, 17 November 2009 01:02 Go to previous message
a.mozafari1211 is currently offline  a.mozafari1211
Messages: 16
Registered: February 2009
Junior Member
On Nov 16, 7:05 am, David Fanning <n...@dfanning.com> wrote:
> ali mozafari writes:
>> Thank you David. How if we don?t know (b). I mean producing N numbers
>> with Spacing (s) and initial number (a).
>
> And, if you wanted to N numbers between A and B:
>
>    numbers = Scale_Vector(Findgen(N), a, b)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Thank you David.
Cheers
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Wohnwagen Gasschlauch
Next Topic: An Introduction

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

Current Time: Fri Oct 10 09:56:57 PDT 2025

Total time taken to generate the page: 0.02345 seconds