Main Content

wavelen2freq

Convert wavelength to frequency

    Description

    example

    freq= wavelen2freq(wavelen)converts wavelengthwavelento frequencyfrequsing the speed of light in vacuum.

    example

    freq= wavelen2freq(wavelen,c)also specifies the signal propagation speedc.

    example

    [freq,c] = wavelen2freq(___)还返回传播speedcused to compute frequencyfreq. Use this syntax with any of the input arguments in previous syntaxes.

    Examples

    collapse all

    Calculate the frequencies corresponding to wavelengths of 1 and 4 cm. Use the default speed of propagation.

    wavelen = [1e-2,4e-2]; freq = wavelen2freq(wavelen)
    freq =1×21010× 2.9979 0.7495

    Calculate the frequency corresponding to a wavelength of 2 cm. Obtain the propagation speed used to compute the frequency.

    wavelen = 0.02; [freq,c] = wavelen2freq(wavelen,3.0e8)
    freq = 1.5000e+10
    c = 300000000

    Input Arguments

    collapse all

    Signal wavelength, specified as a positive scalar or length-Mvector of positive values. Units are in meters.

    Signal propagation speed, specified as a positive scalar. The default value is obtained fromphysconst('Lightspeed'). Units are in m/s.

    Example:3.0e8

    Data Types:double

    Output Arguments

    collapse all

    Signal frequency, specified as a positive scalar or a length-Mvector of positive values. The size offreqequals the size ofwavelen. Units are in Hz.

    Example:10e6

    Data Types:double

    Signal propagation speed, returned as a positive scalar. Units are in m/s.

    Data Types:double

    Extended Capabilities

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

    Version History

    Introduced in R2021a

    See Also