error in fblinct where matrix dimensions do not agree??
Show older comments
ive been working on simulated system for control and i encounter that there is an error as
"Error using /
Matrix dimensions must agree.
Error in fblinct (line 4)
yD = sin(2*pi*t/T);
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode23 (line 112)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in hw6_Q4 (line 7)
[t,x]=ode23('fblinct',[t0 tf],x0);
"the function is:
function xdot=fblinct(t,x)
global T
% computation of the desired trajectory
yD = sin(2*pi*t/T);
yDdot=(2*pi/T) * cos(2*pi*t/T);
yDddot= -(2*pi/T)^2 * sin(2*pi*t/T);
% computation of the control input
kp=100;
kd=14.14;
f = sin(x(1)) + x(2)*x(3) + x(1)+x(2)^2;
g = 1 + x(1)^2;
y = x(1);
ydot= x(1)*x(2) + x(3);
e = yD - y;
edot= yDdot - ydot;
u = (-f + yDddot + kd*edot + kp*e) / g;
%Plant dynamics
xdot(1) = x(1)*x(2) + x(3);
xdot(2) = -2*x(2) + x(1)*u;
xdot(3) = sin(x(1)) + 2*x(1)*x(2) + u;
the m-file to run is:
clc;
clear all;
close all;
T=10
t0=0; tf=50;
x0=[1 1 1]';
[t,x]=ode23('fblinct',[t0 tf],x0);
yd= sin(2*pi*t/T);
e= yd - y;
plot(t,[yd,x(:,1)])
plot(t,e)
plot(t,x(:,2))
Accepted Answer
More Answers (1)
tilak tenneti
on 5 Nov 2014
0 votes
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!