Why do I receive parse error at line 30
Show older comments
Hello everyone
I'm doing a code for a kalman filter in a mobile robot but i'm not sure as to why i'm getting a parse error at the delta u matrix in line 30 . I have been trying to figure out the error for a while now but no luck. could any one help me?.any help would appreciated
cheers
Daniel
V=0.1;
alpha=0.2;
theta=0:pi/30:pi/4;
K=0:30;
r1=sqrt((x-x1).^2+(y-y1.^2));
r2=sqrt((x-x2).^2+(y-y2.^2));
beta_1=alpha-arcsin(d.*sin(alpha)/sqrt((x-x1)^2+(y-y1)^2));
beta_2=alpha-arcsin(d.*sin(alpha)/sqrt((x-x2)^2+(y-y2)^2));
sigma_v_squared=0.0025;
sigma_a_squared= 0.0036;
sigma_r_sqaured=0.000001;
sigma_beta_squared=0.0000726;
dt=0.05;
P(0)=[0 0 0;0 0 0;0 0 0];
x1=3;
y1=4;
x2=4;
y2=4;
d=1.634;
x_pos=x(K)+(V.*sin(alpha).*cos(theta))/cos(alpha);
Y_pos=Y(K)+(V.*sin(theta));
theta_pos=theta(K)+(V.*tan(alpha)/d);
h_x=[((x-x1)/r1) ((y-y1)/r1) 0 (d.*sin(alpha).*(x-x1))/(r1^2.*sqrt(-(d.*sin(alpha)).^2+(y-y1).^2+(x-x1).^2)) (d.*sin(alpha).*(y-y1))/(r1^2.*sqrt(-(d.*sin(alpha)).^2+(y-y1).^2+(x-x1).^2)) 0; ((x-x2)/r2) ((y-y2)/r2) 0 (d.*sin(alpha).*(x-x2))/(r2^2.*sqrt(-(d.*sin(alpha)).^2+(y-y1).^2+(x-x1).^2)) (d.*sin(alpha).*(y-y2))/(r2^2.*sqrt(-(d.*sin(alpha)).^2+(y-y1).^2+(x-x1).^2)) 0];
delta_x=[1 0 -(V.*sin(theta).*sin(alpha).*dt/cos(alpha)); 0 1 (V.*cos(theta).*dt); 0 0 1];
delta_u=[((sin(alpha).*cos(theta).*dt)/cos(alpha)) (V.*cos(theta).*dt/cos.^2(alpha)) (-V.*sin(theta).*sin(alpha).*dt/cos(alpha)) ; (sin(theta).*dt) 0 (V.*cos(theta).*dt) ; (tan(alpha).*dt/d) (sec^2(alpha).*dt/d) 0];
input_error= [sigma_v_squared 0 ; 0 sigma_a_squared];
measurement_error=(sigma_r_squared).*[1 0 0 ;0 1 0 ;0 0 1].*(sigma_beta_squared).*[1 0 0; 0 1 0; 0 0 1];
%% state covariance matrix
estimated_system_uncertanity=(delta_x.*P(0).*delta_x')+(delta_u.*input_error.*delta_u');
%% Kalman gain matrix
S(K+1)=(h_x.*estimated_system_uncertanity.*h_x')+measurement_error;
Kalman_gain= (estimated_system_uncertanity*h_x'.*S(K+1).^-1);
%% update
innovation=measdat7-lambda_e.*Kalman_gain;
x_pos_updated=x_pos+Kalman_gain.*innovation;
Identity=[1 0 0; 0 1 0; 0 0 1];
updated_system_uncertanity=(Identity-Kalman_gain.*h_x).*estimated_system_uncertanity;
Accepted Answer
More Answers (0)
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!