Documentation

logspace

Generate logarithmically spaced vector

Description

example

y = logspace(a,b)generates a row vectoryof 50 logarithmically spaced points between decades10^aand10^b. Thelogspace函数用于创建频率尤其有用cy vectors. The function is the logarithmic equivalent oflinspaceand the ‘:’ operator.

example

y = logspace(a,b,n)generatesnpoints between decades10^aand10^b.

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

y = logspace(a,pi,n)generatesnpoints between10^aandpi.

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×7105× 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 between10^(1+2i)and10^(5+5i).

y = logspace(1+2i,5+5i,8)
y =1×8 complex104× -0.0001 - 0.0010i 0.0029 - 0.0024i 0.0133 + 0.0040i 0.0147 + 0.0497i -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. Theaargument defines a bound of the interval over whichlogspacegenerates points.acan be real or complex, and the other bound,b, can be either larger or smaller thana. Ifbis smaller thana,那么向量包含降值。

Data Types:single|double
Complex Number Support:Yes

Second bound, specified as a numeric scalar. Thebargument defines a bound of the interval over whichlogspacegenerates points.bcan be real or complex, andbcan be either larger or smaller than the other bound,a. Ifbis smaller thana,那么向量包含降值。

Data Types:single|double
Complex Number Support:Yes

Number of points, specified as a real numeric scalar.

  • Ifnis1,logspacereturns10^b.

  • Ifnis zero or negative,logspacereturns an empty row vector.

  • Ifnis not an integer,logspaceroundsndown and returnsfloor(n)points.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

|

Introduced before R2006a