Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I have a code in matlab but I am trying to get the same code code in python. Here is my matlab code,

function [j,s] = J(x,Dt)
    for n = 0:1:sqrt(length(x))
    	j(n+1) = mean((x(n+1:end)-x(1:end-n)).^2);
    end
    s = Dt*[0:1:length(j)-1];


Can anyone help me to convert it in python where x shape is (10000,1,1) and Dt shape is (10000,)?

What I have tried:

I can create functions, argument and returns but cannot find exact way to write the statement inside for loop for a multidimensional arrays.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900