Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

logspace

Generate logarithmically spaced vector

Syntax

  • y = logspace(a,b)
    example
  • y = logspace(a,b,n)
    example
  • y = logspace(a,pi)

Description

example

y = logspace(a,b) generates a row vector y of 50 logarithmically spaced points between decades 10^a and 10^b. The logspace function is especially useful for creating frequency vectors. The function is the logarithmic equivalent of linspace and the ‘:' operator.

example

y = logspace(a,b,n) generates n points between decades 10^a and 10^b.

y = logspace(a,pi) generates points between 10^a and pi, which is useful in digital signal processing for creating logarithmically spaced frequencies in the interval [10^a,pi].

Examples

collapse all

Create a vector of 50 logarithmically spaced points in the interval [10^1,10^5].

y = logspace(1,5);

Create a vector of 7 logarithmically spaced points in the interval [10^1,10^5].

y1 = logspace(1,5,7)
y1 =

   1.0e+05 *

    0.0001    0.0005    0.0022    0.0100    0.0464    0.2154    1.0000

Create a vector of complex numbers with 8 logarithmically spaced points between 10^(1+2i) and 10^(5+5i).

y = logspace(1+2i,5+5i,8)
y =

   1.0e+04 *

  Columns 1 through 4

  -0.0001 - 0.0010i   0.0029 - 0.0024i   0.0133 + 0.0040i   0.0147 + 0.0497i

  Columns 5 through 8

  -0.1242 + 0.1479i  -0.7150 - 0.0822i  -1.2137 - 2.3924i   4.9458 - 8.6913i

Input Arguments

collapse all

First bound, specified as a numeric scalar. The a argument defines a bound of the interval over which logspace generates points. a can be real or complex, and the other bound, b, can be either larger or smaller than a. If b is smaller than a, then the vector contains descending values.

Data Types: single | double
Complex Number Support: Yes

Second bound, specified as a numeric scalar. The b argument defines a bound of the interval over which logspace generates points. b can be real or complex, and b can be either larger or smaller than the other bound, a. If b is smaller than a, then the vector contains descending values.

Data Types: single | double
Complex Number Support: Yes

Number of points, specified as a real numeric scalar.

  • If n is 1, logspace returns 10^b.

  • If n is zero or negative, logspace returns an empty row vector.

  • If n is not an integer, logspace rounds n down and returns floor(n) points.

See Also

|

Introduced before R2006a

Was this topic helpful?