Main Content

freq2wavelen

Convert frequency to wavelength

    Description

    example

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

    example

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

    example

    [wavelen,c] = freq2wavelen(___) also returns the propagation speed c used to compute wavelength wavelen.

    Examples

    collapse all

    Calculate the wavelengths corresponding to frequencies of 3 and 4 GHz. Use the default speed of propagation.

    freq = [3e9,4e9];
    lambda = freq2wavelen(freq)
    lambda = 1×2
    
        0.0999    0.0749
    
    

    Calculate the wavelength corresponding to a frequency of 4 GHz. Obtain the propagation speed use to compute the wavelength.

    freq = 4e9;
    [lambda,c] = freq2wavelen(freq,3.0e8)
    lambda = 0.0750
    
    c = 300000000
    

    Input Arguments

    collapse all

    Signal frequency, specified as a positive scalar or a length-M vector of positive values. Units are in Hz.

    Example: 10e6

    Data Types: double

    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 wavelength, returned as a positive scalar or length-M vector of positive values. The size of wavelen equals the size of freq. Units are in meters.

    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