Main Content

wavelen2freq

Convert wavelength to frequency

    Description

    example

    freq = wavelen2freq(wavelen) converts wavelength wavelen to frequency, freq using the speed of light in a vacuum.

    example

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

    example

    [freq,c] = wavelen2freq(___) also returns the propagation speed c used to compute frequency freq. 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×2
    1010 ×
    
        2.9979    0.7495
    
    

    Calculate the frequency corresponding to a wavelength of 2 cm. Obtain the propagation speed use 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-M vector of positive values. Units are in meters,

    Signal propagation speed, specified as a positive scalar. The default value is obtained from physconst('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-M vector of positive values. The size of freq equals the size of wavelen. 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™.

    See Also

    Introduced in R2021a