How Matlab draws the envelopes of complex curves

Source: Internet
Author: User

How Matlab draws the envelopes of complex curves

Http://jingyan.baidu.com/article/aa6a2c14d36c710d4c19c4a8.html

If a curve, such as a sound waveform, fluctuates greatly and is complex, it can be smoother and clearer by drawing envelopes. This experience helps newcomers to new MATLAB to complete this process.

Tools/Materials
    • Matlab Software

    • Sample Data

Method/Step
  1. Before and after the treatment of the effect of the comparison, illustrated by a sound wave Fourier transform (FFT) after the spectral map.

  2. The original data for the horizontal ordinate for frequency and amplitude, are <2048x1 double> data, that is, contains 2048 data points, by subplot (2,2,1), Plot (fr,am); Drawn.

  3. The formation of envelopes, it is necessary to divide the original data into small segments of equal width, each section takes a high point corresponding to the horizontal axis and ordinate (). For example, set the length of each small segment to D = 4 or 8 or 16 (or 2048 for other approximate), and then run

    Y=reshape (AMPLITUDE,D,2048/D);

    Y=max (y);

    X=linspace (0,max (frequency), 2048/d);

    The resulting x and y are the horizontal ordinate of the envelope line.

  4. The key functions are reshape () and linspace ().

    The reshape () function resizes the number of rows, columns, and dimensions of the matrix. Reshape (x,m,n) can adjust the matrix X to a matrix of m rows n columns, such as:

    >> reshape ([1 2 3 4 5 6],2,3)

    Ans =

    1 3 5

    2 4 6

    Linspace () is used to produce linear vectors. Linspace (A,b,n) can produce a one-dimensional array of a total of n elements from A to B. Like what:

    >> Linspace (1,5,4)

    Ans =

    1.0000 2.3333 3.6667 5.0000

How Matlab draws the envelopes of complex curves

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.