How to filter noisy function ?

3 次查看(过去 30 天)
Yasemin Derme
Yasemin Derme 2018-8-10
I have a gaussian function which outputs a 1-by-1001 matrix. It also has a noise. I want it to work 1000 times and to choose matrices with relatively less noise. Then, I want to create another matrix composed of the relatively less noisy matrices. How can I achieve this ?
function [gf] = two_stars_random(C1,x01,s1,C2,x02,s2,N)
randCoeff=0.5;
a=(1-randCoeff)+2*randCoeff*rand(1);
C1t = a*C1;
a=(1-randCoeff)+2*randCoeff*rand(1);
x01t = a*x01;
x02t = x02+(x01t-x01);
a=(1-randCoeff)+2*randCoeff*rand(1);
s1t=a*s1;
a=(1-randCoeff)+2*randCoeff*rand(1);
C2t = a*C2;
a=(1-randCoeff)+2*randCoeff*rand(1);
s2t=a*s2;
N=1000;
range_begin = 0;
range_end = 1;
x=range_begin:(1.0/N):range_end;
g1=C1t*exp(-(x-x01t).^2/(2*s1t^2));
g2=C2t*exp(-(x-x02t).^2/(2*s2t^2));
b=0.2*rand(1)*(C1t+C2t)*rand(1,N+1);
gf=g1+g2+b;
end
  7 个评论
Yasemin Derme
Yasemin Derme 2018-8-12
Okay, thanks a lot for your help.
function [gf] = two_stars(C1,x01,s1,C2,x02,s2,N)
C1=27.8498 ; % either expands (C1>1) or shrinks (0<C1<1) the curve vertically, reflects with respect to x axis when C1<0
C2=54.6882; % either expands (C2>1) or shrinks (0<C2<1) the curve vertically, reflects with respect to x axis when C1<0
x01=95.7507; % either shift right(x01>0) or left(x01<0)
x02=96.4889; % either shift right(x02>0) or left(x02<0)
s1=15.7613; %either expand (if s1 increases) or shrink (if s1 decreases) the curve horizontally
s2=97.0593; %either expand (if s2 increases) or shrink (if s2 decreases) the curve horizontally
N=10000;
range_begin = -50;%start from x1 point
range_end = 50;%ends in x2 point
x=range_begin:(1.0/N):range_end;%determines the rate with which the function will take into account the points
g1=C1*exp(-(x-x01).^2/(2*s1^2));%gaussian function
g2=C2*exp(-(x-x02).^2/(2*s2^2));%gaussian function
gf=g1+g2;%the sum of two gaussian functions
plot(g1+g2+ 0.5*rand(size(x)))
Yasemin Derme
Yasemin Derme 2018-8-12
This is the function that I've been working on:
t=1001;
A = zeros(t-1,t);
for i =1:t-1
stack(i,:) = two_stars_random(C1,x01,s1,C2,x02,s2,N);
if b<0.1
A = stack(i,t);
elseif b>0.1
A = zeros(1,t);
end
[r,~]=size(A);
filtered(r,t) = A;
end

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Beamforming and Direction of Arrival Estimation 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by