当前统计模型 matlab代码

有木有人有当前统计模型的MATLAB代码呢?(不要一维的)

不知道这个是不是你要的。
参考地址:https://zhidao.baidu.com/question/291415817.html
如有帮助,望采纳。点击我回答右上角【采纳】按钮。

%Create a signal
t = [0:0.001:1];
sub_t = 100;
signal=cos(2*pi*50*t);%+2*sin(2*pi*120*t);
figure;
subplot(2,1,1);
plot(t(1:sub_t),signal(1:sub_t),'g'),title('ORIGINAL SIGNAL'),xlabel('time (s)');
%Add noise to the signal
randn('state',0);
sign_and_noise = signal + 0.5*randn(size(t));
hold on;subplot(2,1,1);
plot(t(1:sub_t),sign_and_noise(1:sub_t),'b'), title('SIGNAL');xlabel('time (s)');
legend('original','disturbed');
N=2048;
SIG= abs(fft(signal,N));
SIG = fftshift(SIG);
F = [-N/2:N/2-1]/N;
figure;
subplot(3,1,1);
plot(F,SIG),title('ORIGINAL SIGNAL IN FREQUENCY DOMAIN');
xlabel('freq');ylabel('magnitude (dB)');
SIG_NOISE= abs(fft(sign_and_noise,N));
SIG_NOISE = fftshift(SIG_NOISE);
subplot(3,1,2);
plot(F,SIG_NOISE);title('DISTURBED SIGNAL IN FREQUENCY DOMAIN');
xlabel('freq');ylabel('magnitude (dB)');
%Create An Ideal LowPass
f = [0:length(t)-1]/length(t);
low_pass = rectpuls(f, 0.15);
subplot(3,1,3);
plot(f, low_pass);title('LOW PASS FILTER');
xlabel('freq');ylabel('magnitude (dB)');
lp_t = fftshift(real(ifft(low_pass)));
figure
plot(lp_t);
%Convolution in time domain
res = conv(sign_and_noise, real(ifft(low_pass)));
figure(1);
subplot(2,1,2);
plot(t(1:sub_t), res(1:sub_t),'k');
%Product in frequency domain
res_freq = fft(sign_and_noise) .* (low_pass);
res_time = real(ifft(res_freq));
hold on, subplot(2,1,2);
plot(t(1:sub_t), res_time(1:sub_t),'r'),title('RECONSTRUCTED SIGNAL');xlabel('time (s)');
hold on, subplot(2,1,2);
plot(t(1:sub_t), signal(1:sub_t),'b-.');
legend('convolution in t','product in f','original');
另外一种:
function H = highpassfilterBW(sze, cutoff, n)
if cutoff < 0 | cutoff > 0.5
error('cutoff frequency must be between 0 and 0.5');
end
if rem(n,1) ~= 0 | n < 1
error('n must be an integer >= 1');
end
if length(sze) == 1
rows = sze; cols = sze;
else
rows = sze(1); cols = sze(2);
end
% Set up X and Y matrices with ranges normalised to +/- 0.5
% The following code adjusts things appropriately for odd and even values
% of rows and columns.
if mod(cols,2)
xrange = [-(cols-1)/2:(cols-1)/2]/(cols-1);
else
xrange = [-cols/2:(cols/2-1)]/cols;
end
if mod(rows,2)
yrange = [-(rows-1)/2:(rows-1)/2]/(rows-1);
else
yrange = [-rows/2:(rows/2-1)]/rows;
end
[x,y] = meshgrid(xrange, yrange);
radius = sqrt(x.^2 + y.^2);
H = 1.0 ./ (1.0 + (radius ./ cutoff).^(2*n));
figure, mesh(x,y,H); colorbar;
title('Butterworth high pass filter reponse');

可以参考这个资源,积分不够可以帮你下载:https://download.csdn.net/download/yb1449352/14951759?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162562504116780264095867%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fdownload.%2522%257D&request_id=162562504116780264095867&biz_id=1&utm_medium=distribute.pc_search_result.none-task-download-2~download~first_rank_v2~rank_dl_default-1-14951759.pc_v2_rank_dl_default&utm_term=%E5%BD%93%E5%89%8D%E7%BB%9F%E8%AE%A1%E6%A8%A1%E5%9E%8B+matlab%E4%BB%A3%E7%A0%81&spm=1018.2226.3001.4451