Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Index exceeds matrix dimensions

2 visualizaciones (últimos 30 días)
sihem bk
sihem bk el 5 de Nov. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hello,i'm trying to plot the synchronization error under the hybrid control, iget this error :
Index exceeds matrix dimensions.
Error in Untitled21 (line 16)
e(:,k+1)= (A*((Y(k ,:))-(x(:,k))))+(fy-fx);
and this my code :
clear all
clc
a=1.07;
b=0.3;
n= 50;
K(1)=0;
%Z(1)=0;
x(:,1)=[(-1.2) ; 0 ; 0.3 ];
y(1,:)=[(-1.54); 0 ; 0.46];
Y=transpose(y)
for k=1:n
%for Z=1:n
fx=[1-a*((x(1))^2)*(k) ; 0 ;0 ];
fy=[1-a*((Y(1))^2)*(k) ; 0 ; 0 ];
A=[0.12 -0.18 0;0 0.15 -0.18;0 0 0.18];
e(:,k+1)= (A*((Y(k ,:))-(x(:,k))))+(fy-fx);
K(k+1)=k;
%end
end
plot(K,e(1,:),'red')
hold on
plot(K,e(2,:),'green')
hold on
plot(K,e(3,:),'blue')
  2 comentarios
madhan ravi
madhan ravi el 5 de Nov. de 2018
Huge mess
sihem bk
sihem bk el 5 de Nov. de 2018
in what

Respuestas (1)

Tally Miller
Tally Miller el 5 de Nov. de 2018
I don't know what you are trying to do here, but you are getting the error message because you are trying to access x(:,k) when x is a matrix with the dimensions [3,1]. It happens once i is greater than 1.
The debugging tool might help you with this.
  1 comentario
sihem bk
sihem bk el 5 de Nov. de 2018
i'm trying to plot this

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by