Filter löschen
Filter löschen

Is it a right conversion from java to matlab? I am getting error. I am new on matlab and confused on functions.

2 Ansichten (letzte 30 Tage)
// Java code
public static void xp_system(int n,double t,double[x],int i){
// differential equation
k[1][i]= -3*x[2];
k[2][i]= (1/3)* x[1];
}
// matlab code
function xp(n,t,x,i)
int8 n;
k(1,i)=3*x(2); // too many input argument
k(2,i)=(1/3)*x(1); // too many input argument
end
  3 Kommentare
Walter Roberson
Walter Roberson am 5 Apr. 2018
k(1+1,i+1) = 3*x(2+1);
k(2+1,i+1) = (1/3) * x(1+1);
I suspect the code has a bug in it, but it is difficult to say as it does not declare k and does not appear to return anything.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Java Package Integration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by