4 analog / dp | modern communication

Posted by phpPete on Wed, 05 Jan 2022 11:57:10 +0100

Into modern communication

Shannon Weaver model

A linear and unidirectional framework is constructed to describe the information dissemination process of the generalized communication system. This mode includes six parts: source, transmitter, channel, noise, receiver and sink.

  1. Source and sink: source is the source of information; The destination is the destination of information, which is the entity receiving information. These two concepts are relative and can be converted in different scenarios. For example, the radio is the sink when it receives the radio signal; When the program sounds, it is the source of information. At this time, the people listening to the radio become the destination.
  2. Transmitter and receiver: encoding and decoding.
  1. Channel and noise:
  2. Communication mode: duplex, half duplex, simplex.

Contemporary communication

3G

It is divided into WCDMA, cdma2000 and TD-SCDMA

WCDMA and cdma2000 belong to frequency division duplex (FDD), while TD-SCDMA belongs to time division duplex (TDD). WCDMA and cdma2000 share the corresponding bandwidth exclusively for uplink and downlink. A certain frequency interval is required between uplink and downlink as an "isolation band" to avoid interference; TD-SCDMA uses the same spectrum for uplink and downlink, and "traffic lights" need to be provided between uplink and downlink to avoid interference.

4G

LTE

The LTE system introduces orthogonal frequency division multiplexing (OFDM) and multiple input multiple output (MIMO), which significantly improves the spectral efficiency and data transmission rate.

According to different duplex modes, LTE system is divided into FDD-LTE and TDD-LTE. The main difference between the two technologies lies in the physical layer of the air interface (for example, frame structure, time division design, synchronization, etc.). The FDD air interface receives and transmits data in pairs and different frequency bands, while the uplink and downlink of the TDD system use the same frequency band to transmit on different time slots. TDD has higher frequency utilization than FDD.

LTE-A:

LTE-A adopts key technologies such as Carrier Aggregation (CA), uplink / downlink multi antenna enhancement, multipoint cooperative transmission, relay and heterogeneous network interference coordination enhancement, which can greatly improve the peak data rate, peak spectral efficiency, cell average spectral efficiency and cell boundary user performance of the wireless communication system. The so-called multi Carrier Aggregation is to aggregate the network signals of multiple frequency bands, which is equivalent to changing the highway from "single lane" to "multi lane".

5G

According to the definition of 3GPP, the three application scenarios of 5G are eMBB, mMTC and URLLC. eMBB is to enhance mobile broadband, ultra-high speed and support large traffic mobile broadband services; mMTC refers to mass machine communication, Internet of things; URLLC, low latency.

Generally, the size of the antenna is 1 / 4 of the wavelength of the electromagnetic wave signal.

modulation

Changing from baseband digital signal to RF signal requires two steps:

  1. Conversion of baseband digital signal to baseband analog signal - digital to analog;
  2. Analog baseband signal is converted into RF signal - low frequency to high frequency.

(1) Analog signal modulation (low frequency to high frequency) analog modulation is divided into amplitude modulation and angle modulation

  • Amplitude modulation: use the modulation signal to control the amplitude of the high-frequency carrier so that it changes according to the law of the modulation signal. Use the amplitude of the carrier to carry information, but the frequency of the carrier remains unchanged.

(I didn't understand the following) p73

Antenna transmission

Principle of electromagnetic radiation

When a high-frequency current is applied to a conductor, the surrounding space will generate an electric field and a magnetic field at the same time. According to the spatial distribution characteristics of electromagnetic field, it can be divided into near area (reactance near field), middle area (radiation near field) and far area (radiation far field).

Basic principle of antenna

I don't understand. Forget it

Wireless channel and channel fading

Nyquist bandwidth: a perfect channel without noise

When the symbol rate (symbol rate) is 1 / T (the transmission time of each symbol is T), the minimum bandwidth required for intersymbol crosstalk free transmission is 1/2T, which reveals the relationship between bandwidth.

Nyquist rate and Nyquist bandwidth are two sides of the same theory. Nyquist rate refers to the maximum symbol rate without inter symbol interference in the case of noise free ideal low-pass channel, and its expression is:

C = 2hlog2n, C is the information transmission rate (in bit/s), H is the bandwidth of the ideal low-pass channel (in Hz), and N is the number of discrete values corresponding to a symbol (coding series or polyphase modulation Series).

Nyquist loan and speed prove a very important point, that is, without noise, the limitation of data rate only comes from the bandwidth of the signal. The Nyquist bandwidth and rate can be described as: under the ideal condition of no noise, if the bandwidth is B, the maximum signal rate that can be transmitted is 2B; Conversely, if the signal transmission rate is 2B, the bandwidth of bandwidth B can fully reach the transmission rate of this signal.

simulation

5 longest palindrome substring

Force buckle

Naive solution

  • Enumeration string
  • If the length of palindrome string is odd, judge s[i-k]==s[i+k],k=1,2,3
  • If the length of palindrome string is even, judge s[i-k]==[i+k-1],k=1,1,3
    public String longestPalindrome(String s){
        String ans = "";
        for(int i=0;i<s.length();i++){
            //Palindrome string is odd
            int l = i-1,r=i+1; 
            String sub = getString(s,l,r);
            if(sub.length()>ans.length()) ans = sub;
            
            //Palindrome string is even
            l = i-1;
            r = i+1-1;
            sub = getString(s,l,r);
            if(sub.length()>ans.length()) ans = sub;
            
        }
        return ans;
    }
    
    String getString(String s,int l ,int r){
        while(l>=0&&r<s.length()&&s.charAt(l)==s.charAt(r)){
            l--;
            r++;
        }
        return s.substring(l+1,r); // l+1 is because l -- is, and the corresponding range should be + 1, while r cannot be obtained due to api, so it does not need to be processed.
        //That is, substring is left closed and right open.
        
    }

dynamic programming

Force buckle

  public String longestPalindrome(String s) {
		  int len = s.length();
		  if(len<2) {
			  return s;
		  }
		  
		  int maxLen =1;
		  int begin = 0;
		  boolean[][] dp = new boolean[len][len];
		  //dp[i][j] indicates whether s[i:j] is a palindrome string
		  for(int i=0;i<len;i++) {
			  dp[i][i] = true; // Single is true
		  }
		  char[] charArray = s.toCharArray();
		  //Recurrence start
		  //Enumerate substring length first
		  for(int L=2;L<=len;L++) { // length
			  //Enumerate the left boundary. The upper limit of the left boundary can be set loosely
			  for(int i=0;i<len;i++) {
				  //The right boundary can be determined by L and i, that is, j-i+1=L
				  int j = L+i-1;
				  //If the right boundary is out of bounds, you can exit the current loop
				  if(j>=len) break;
				  
				  if(charArray[i]!=charArray[j]) {
					  dp[i][j] = false ;
				  }else {
					  if(j-i<3) {//1 and 2 1: indicates that the two characters are equal in the even number state, which is palindrome, and 2 is palindrome in the odd number state. Judgment of boundary conditions
						  dp[i][j] = true;
					  }else {
						  dp[i][j] = dp[i+1][j-1];  //State transition, outward expansion
					  }
				  }
				  
				  //As long as dp[i][L] ==ture is true, it means that the substring s[i,L] is a palindrome. At this time, the palindrome length and starting position are recorded.
				  if(dp[i][j]&&j-i+1>maxLen) {
					  maxLen = j-i+1;
					  begin = i;
				  }
			  }
		  }
		  return s.substring(begin, begin + maxLen);
	  }

simulation

43 string multiplication

Force buckle

  • When the two numbers are multiplied, the maximum length will not exceed n+m, so create an array with a length of n+m to receive the result.
  public String multiply(String n1, String n2) {
        int n = n1.length(), m = n2.length();
        int[] res = new int[n + m];
        for (int i = n - 1; i >= 0; i--) {
            for (int j = m - 1; j >= 0; j--) {
                int a = n1.charAt(i) - '0';
                int b = n2.charAt(j) - '0';
                int r = a * b; // Get the multiplication first
                r += res[i + j + 1]; //  i and j are decreasing, and + 1 is the low order of the corresponding two digits.
                // For example, if 123 and 456 are 3 and 6, the calculated i+j is 4. In fact, there is only one bit. If you look down, the subscript is 5, and subscript 5 is the lowest bit.
                res[i + j + 1] = r % 10;
                res[i + j] += r / 10;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n + m; i++) {
            if (sb.length() == 0 && res[i] == 0) continue;
            sb.append(res[i]);
        }
        return sb.length() == 0 ? "0" : sb.toString();
    }

73 matrix zeroing

The spatial solution of O (1).

  • Use two variables (R0 & C0) to record whether [first row & first column] should be set to zero
  • [non first row and first column position] 1. Store the zero setting information in the original matrix. 2. Set the position of [non first row and first column] according to the zero setting information
  • Use r0&c0 zero [first row & first column]
     
	  public void setZeroes(int[][] mat) {
	        int m = mat.length, n = mat[0].length;
	        
	        //1 scan [first row] and [first column] to record whether [first row] and [first column] are set to zero
	        boolean r0=false,c0=false ;
	        for(int i=0;i<m;i++) {
	        	if(mat[i][0]==0) {
	        		r0 = true;
	        		break;
	        	}
	        }
	        for(int j=0;j<n;j++) {
	        	if(mat[0][j]==0) {
	        		c0 = true;
	        		break;
	        	}
	        }
	        
	        //Scan the position of [non first row and first column]. If zero is found, store the information to be set to zero in the [leftmost] and [uppermost] grids of the row
	        for(int i=1;i<m;i++) {
	        	for(int j=1;j<n;j++) {
	        		if(mat[i][j]==0) mat[i][0] = mat[0][j]=0;
	        	}
	        }
	        
	        // According to the zero setting information just recorded in the [leftmost] and [uppermost] grids, set the [non first row and first column] to zero
	        for(int j=1;j<n;j++) {
	        	if(mat[0][j]==0) {
	        		for(int i=1;i<m;i++) mat[i][j] = 0;
	        	}
	        }
	        
	        for(int i=1;i<m;i++) {
	        	if(mat[i][0]==0) Arrays.fill(mat[i], 0);
	        }
	        
	        if(r0) for (int i=0;i<m;i++) mat[i][0]=0;
	        if(c0) Arrays.fill(mat[0], 0);
	  }

Topics: network Network Protocol