Skip to main content

All Questions

Tagged with
1 vote
2 answers
121 views

Scipy Null Space Innacurate only for Complex Values

I've got a program that computes the null space of a matrix using scipy null_space. My code works absolutely perfectly when the matrix is real but seems to contradict results in MATLAB for complex ...
marcus1518's user avatar
1 vote
0 answers
56 views

How to dynamically update a single plot for multiple iterations in Python (equivalent to MATLAB drawnow)?

I am trying to translate the following MATLAB code to Python. In MATLAB, the code dynamically updates a single plot for multiple iterations (n = 1:100), and each update displays the interpolation ...
Mohamed's user avatar
  • 11
2 votes
1 answer
59 views

p-values for all pairs between two matrices to achieve matlab's corr function

I have been trying to implement in Python (with numpy and scipy) this variant of Matlab's corr function, but it seems I cannot solve it by myself. What I need is to implement the alternative Matlab ...
Gustavo Patow's user avatar
1 vote
0 answers
68 views

Import numpy and scipy to Matlab

Introduction. I have the following Python function, which is saved as "anderson_darling.py": def ADtest(a,b): rng = np.random.default_rng() method = stats.PermutationMethod(...
BostonPlummer's user avatar
2 votes
1 answer
56 views

how to read Matlab duration object from Python?

I create a Matlab duration object and save it to a .mat file: timeend = seconds(123); save('time.mat', timeend, '-v7.3'); Then I read it from Python: with h5py.File('time.mat', 'r') as f: var = ...
Xin Niu's user avatar
  • 635
0 votes
1 answer
42 views

How can I reproduce Matlab file reading with Python and Numpy for decoding a .dat file?

I have a Matlab script that reads an encoded .dat file, decodes it and saves it. I was trying to translate this into Python using numpy. I've found that for the same file, I get different output ...
gunk's user avatar
  • 11
2 votes
1 answer
67 views

Create a similar matrix object in matlab and python

For comparison purposes, I want to create an object which would have the same shape and indexing properties in matlab and python (numpy). Let's say that on the matlab side the object would be : ...
servoz's user avatar
  • 687
167 votes
8 answers
211k views

numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

I want to call my Python module from the Matlab. I received the error: Error using numpy_ops>init thinc.backends.numpy_ops Python Error: ValueError: numpy.dtype size changed, may indicate binary ...
Encipher's user avatar
  • 3,178
1 vote
1 answer
267 views

How to pass large arrays of data from MATLAB to Python

My data is stored in classes in MATLAB which contain large arrays but want to work with that data in python for training machine learning. From what I can tell, when moving data between the two, the ...
Leon Williams's user avatar
0 votes
1 answer
191 views

How to use arrays in Python similar to how they're used in matlab

I'm currently trying to improve my python skills by using it to recreate some old matlab projects I did in undergrad. I once used matlab to simulate a proton attracting an electron, using ...
Hector Viruega's user avatar
0 votes
0 answers
79 views

Matlab Versus Python - Interpolation Errors with Matlab "scatteredInterpolant" versus Python's "Griddata" from scipy.interpolate

I'm currently trying to convert some Matlab code into Python. I'm running into an error that I suspect has to do with rounding, but am unsure about what is causing it. Matlab: deg2rad = pi/180; % ...
Sweet Zhang's user avatar
0 votes
0 answers
68 views

Numpy ndArray is not flattening with flatten()

I have a numpy ndArray which is of shape (500,20,8) of float64. Keep in mind however that when I get the shape of such array, I get the following output. I do not know if this is OK: mat = sp.loadmat('...
akaBryan's user avatar
  • 112
0 votes
0 answers
69 views

Signs of Matlab and Numpy Graph Fourier Transform Matrix are Different

I would like to ask why I see the same numerical results but with different signs for the same demo data. I understand that the signs are arbitrary, but I'm using the transpose of this matrix in later ...
Michael Paglia's user avatar
-1 votes
1 answer
243 views

Is there a Python equivalent of Matlab's potential(V, X, Y) function

Is there a library in python that provides the same functionality as Matlab's potential(V,X) function, which inverts a 3D or 2D gradient into a scalar potential surface? I've tried a couple of brute-...
Bill Capehart's user avatar
0 votes
0 answers
118 views

Converting derivative block of Simulink into a python code

I have a Simulink model and I want to translate the whole model to a python code. Now I am struggling with the translation of a block named "derivative". The documentation regarding this ...
Soheil yns's user avatar

15 30 50 per page
1
2 3 4 5
64