Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
// 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 commentaires
Walter Roberson
Walter Roberson le 5 Avr 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Java Package Integration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by