0

from MATLAB to Python

please can anyone help me convert this MATLAB code to a Python code? thanks in advance. RexLev_pf = 6; ca_filtered = -82.3826; RexQual_pf = 75; qa_filtered = 22.0392; sfactor = 3; qfactor = 6; Starget = [-110:1:-47]; Qtarget = [22, 18, 16, 14, 12, 9, 6, 4]; for i = 1:64 for j = 1:8 output1(i,j) = (-((RexLev_pf)*(ca_filtered - Starget(i))+ (RexQual_pf)*(qa_filtered - Qtarget(j)))); output2(i,j) = (-((sfactor)*(ca_filtered - Starget(i)) + qfactor*(qa_filtered - Qtarget(j)))); end end

18th Mar 2019, 5:11 PM
Khaled Gamal Saad
Khaled Gamal Saad - avatar
7 odpowiedzi
+ 10
I dont know MATLAB, but I think I got most of the code converted. one question, what is the Stargent variable supposed to be?
18th Mar 2019, 10:34 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 7
ok Khaled Gamal Saad, i updated the code. I think it's what you wanted.
19th Mar 2019, 5:04 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 5
ok here you go. https://code.sololearn.com/cTxJ8th0yva8/?ref=app It will raise a index error because the Stargent variable is only 53 elements long to the i range is trying to go through it 64 times.
18th Mar 2019, 10:50 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 1
thank you LONGTIE👔 :)
19th Mar 2019, 5:37 PM
Khaled Gamal Saad
Khaled Gamal Saad - avatar
0
Starget is the signal strength that the mobile phone should attain, and it lies within the range from -110 dB to -47 dB
18th Mar 2019, 10:38 PM
Khaled Gamal Saad
Khaled Gamal Saad - avatar
0
thank you so much ☺️ and Starget has 64 elements in it, not 53
18th Mar 2019, 11:00 PM
Khaled Gamal Saad
Khaled Gamal Saad - avatar
0
I want the outputs to be in matrices of 8 rows*64 columns
18th Mar 2019, 11:02 PM
Khaled Gamal Saad
Khaled Gamal Saad - avatar