Clear Filters
Clear Filters

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

2 views (last 30 days)
// 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 Comments
Walter Roberson
Walter Roberson on 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.

Sign in to comment.

Answers (0)

Categories

Find more on Java Package Integration 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!