matlab

I rewrite a matlab code in python but they result different outputs

I rewrite a matlab code in python but they result different outputs Question: the matlab code and the output i was expecting (gauss elimination method) my code in python: import numpy as np A = np.array([ [1,2,-1,1], [-1,4,3,1], [2,1,1,1]]) n = rows = len(A) col = len(A[0]) for i in range(n): A[i,:] = A[i,:] / …

Total answers: 1

4D Matrix operation in Python – conversion from MATLAB

4D Matrix operation in Python – conversion from MATLAB Question: I’m trying to translate this MATLAB code to Python: MATLAB: V_c = delta* max(V_L, repmat(V_A_c,[N_p 1]) – NM ) where these are 4D arrays: V_c is the continuation value for in different states, (should have shape 81, 75, 15, 31) V_L is the initial value, …

Total answers: 2

Python correspondent for MATLAB matrix operation

Python correspondent for MATLAB matrix operation Question: I have a vector of indices (let’s call it peo), a sparse matrix P and a matrix W. In MATLAB I can do an operation of this kind: P(peo, peo) = W(peo, peo) Is there a way to do the same in Python maintaining the same computational and …

Total answers: 1

Python Channelizer

Python Channelizer Question: After years of telling myself I would, I’m finally switching from MATLAB to Python. I am having difficulty finding a Python equivalent to MATLAB’s Channelizer. Is there one? Asked By: djg135 || Source Answers: Yes, PyFilterBank will do the trick. Answered By: Igor Rivin

Total answers: 1

Same script computes different results on Matlab and Python

Same script computes different results on Matlab and Python Question: I am trying to implement softmax function but weirdly I am getting two different outputs on MATLAB and on Python: MATLAB script: function sm = softmax(Y) e_y = exp(Y – max(Y)) sm = e_y / sum(e_y) which computes ten times 0.1 as a column vector …

Total answers: 1

What is equivalent of Matlab nan( ) in python?

What is equivalent of Matlab nan( ) in python? Question: this is my MATLAB code with the following output: pad=nan(1,5) pad = NaN NaN NaN NaN NaN I want to do the same operation in python, I tried np.isnan(1,6) but this is not working. what should I used to get the same results. thank you …

Total answers: 2

I am trying to convert these 2 lines of Matlab code into python. first line is fine but how could I change the 2nd line?

I am trying to convert these 2 lines of Matlab code into python. first line is fine but how could I change the 2nd line? Question: This is my MATLAB code. Note that T_cqi=28 gamma_real=reshape(gamma_dB(:,(length(CQI_init)+1):end),[1,length(CQI_test)*T_cqi]); gamma_real=gamma_real(1:(end-(T_cqi-1))); This part in matlab is (length(CQI_init)+1=180 in python it works with 179 I convert it like this: gamma_real=np.reshape(gamma_dB[:,179:],[1,(CQI_test.size)*T_cqi]) which …

Total answers: 1

Python equivalent of Matlab bsplinepolytraj function?

Python equivalent of Matlab bsplinepolytraj function? Question: Good morning everyone, this is my first question so I apologize in advance for any kind of mistake. Let me explain my problem: I need to generate a trajectory for a robotic arm from a set of waypoints. In Matlab I used the function bsplinepolytraj, but now I …

Total answers: 2