Calculating Characteristics of Random Signals Using MATLAB

First, generate two random time series, then calculate the mean, standard deviation, median, maximum, minimum, and correlation coefficient matrix of these sequences, and finally display the processing results.

% Clear all; clc; close all; % Generate random data A1=3.0*randn(1,2000); B1=5.0*randn(1,2000); % Mean disp(‘Mean values’); mean_A=mean(A1); mean_B=mean(B1); % Standard deviation disp(‘Standard deviations’); std_A=std(A1); std_B=std(B1); % Maximum value disp(‘Maximum values’); max_A=max(A1); max_B=max(B1); % Minimum value disp(‘Minimum values’); min_A=min(A1); min_B=min(B1); % Median disp(‘Median values’); median_A=median(A1); median_B=median(B1); % Sort from smallest to largest disp(‘Sorting’); order_A=sort(A1); order_B=sort(B1); figure(3); plot(order_A,’b-‘); title(‘Sorted A1’); xlabel(‘A1’); figure(4); plot(order_B,’b-‘); title(‘Sorted B1’); xlabel(‘B1’); % Covariance disp(‘Covariance matrix’); covAB=cov(A1,B1); % Correlation coefficient disp(‘Correlation coefficient matrix’); corAB=corrcoef(A1,B1); %%%%%%%%%%%%%%%%%%%%%% figure(1); plot(A1,’b-‘); title(‘A1’); xlabel(‘A1’); ylabel(‘x’); legend(‘A1’); grid on; grid on; figure(2); plot(B1,’b-‘); title(‘B1’); xlabel(‘B1’); ylabel(‘x’); legend(‘B1’); grid on; grid on;

Leave a Comment