unweighted least square estimation with fminsearch
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hallo every one,
I have an equation or model which it must be fited to a part of a real signal (radar waveform) in order to estimate three parameter.
I should do an unweighted least-square estimation whose convergence is reachedt through the Nelder-Mead (NM) algorithm.
max nummber of iteration allowed is 600 , and the function toleranc is 10^-01
and wenn convergence is not met, i must widening the real signal that i have by one value until convergence is reached.
so far
- I wrote the equation with all the constansts
- took the sum of squares cost function and make it handle function
- tried to reach the convergence and get the parameters
%% Brown Modell fitting
k = size(n_1);
t = k* rt ;
% Constant Parameters
alt_20hz= lat_01(1,1);
off_nadir_angle_wf_20hz_ku = F_off_nadir_angle_wf_ocean_01_ku(1,1) ;
c = 299792458 ; % speed of light m/s
Re = 6371000 ; % the earth raduis meters
antenna_w = rad2deg(1.28) ; % the antenna beam width
rt = 3.125 * 10.^-6 ; % time resolution nano seoconds
sigma_p = 0.513 * rt ; % width of the radar point target response
% the Equation
lamda = (sin(antenna_w).^ 2 )* (1 / ( 2 * log(2)));
a = (4 * c ) / (lamda .* alt_20hz * (1+ (alt_20hz / Re)));
b_offnadirangel = cos( 2 .* sqrt(off_nadir_angle_wf_20hz_ku)) - (( sin(2 * off_nadir_angle_wf_20hz_ku)) / lamda ) ;
c_offnadirangel = b_offnadirangel .* a ;
a_offnadirangel = exp(-4* sin(off_nadir_angle_wf_20hz_ku))./ (lamda);
% Parameter estimation
MaxIter =600 ;
f1 = n_1 ; % the real signal
fun = @(P)sum(f1 - (a_offnadirangel .* P(1).^(( 1 + erf((t - P(2) - c_offnadirangel .* P(3).^2 )/...
( sqrt(2) .* P(3))) ) / 2) .* exp(-1 .*(c_offnadirangel .* ( t - P(2) - (0.5 .* c_offnadirangel .* P(3).^2)))) + Tn)).^2 % sum of squares cost function
% Start with the default options
options = optimset;
options = optimset(options,'Display', 'off');
options = optimset(options,'MaxIter', 600);
options = optimset(options,'MaxFunEvals', 600);
options = optimset(options,'TolFun', 10^-10);
options = optimset(options,'TolX', 10^-10);
x0 =[0,0,0]; % initial Parameter estimation
MaxIter = 600 ;
Tol_fun = 10^-10 ;
% wenn the convergence is not reach the stop gate is increased one (the estimation window is windend)
while c <= MaxIter
P = fminsearch(fun,x0,options); % Minimise 'cost P'
if abs(fun) < Tol_fun
break;
else
stop_gate = stop_gate +1
n_1 = waveform_norm(edge_foot(1):stop_gate(1))' ;
P = fminsearch(fun, x0, options);
end
c=c+1 ;
end
I seems like I am doing something wrong, I am getting the following error :
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2.
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Can someone help me with this? Big thanks in advance!
0 Commenti
Risposte (1)
Star Strider
il 15 Nov 2018
You should be summing the squares, not squaring the sum.
Try this:
fun = @(P)sum((f1 - (a_offnadirangel .* P(1).^(( 1 + erf((t - P(2) - c_offnadirangel .* P(3).^2 )/...
( sqrt(2) .* P(3))) ) / 2) .* exp(-1 .*(c_offnadirangel .* ( t - P(2) - (0.5 .* c_offnadirangel .* P(3).^2)))) + Tn)).^2) % sum of squares cost function
I cannot run your code, so I cannot test this.
9 Commenti
Torsten
il 16 Nov 2018
Then something is wrong with your function "fun". It must return a scalar value (size must be [1 1 ]).
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!