Questions tagged [linspace]
56 questions
0
votes
2 answers
Create sequences of random numbers with the same distance in R
I am trying to create sequences of five random numbers, within a range of values, where the elements have the same distance to each other. I am an R user.
in more details:
within that range of numbers
numbers <- seq(0.50,0.75,length=100)
I want to…

LDT
- 2,856
- 2
- 15
- 32
0
votes
0 answers
How to specify multiple "num" parameters for np.linspace function?
I wonder if there is a way to set up a NumPy linspace function with multiple num parameters so that I can create sequence of evenly spaced values with different intervals without any for loop operations.
To illustrate a bit more my issue, I have…

RV-G
- 21
- 5
0
votes
2 answers
Numpy Sinus Behavior for different arrays
Hello depending on the array I put into sinus I get a completely different output. test1, test3 are examples where it is not working. What's going on here?
test1 = np.sin(50.*2.*np.pi*np.arange(0., 512., dtype=np.float64))
test2 =…

user1536844
- 55
- 1
- 10
0
votes
2 answers
Can't extract decimal number from array created with np.linspace in if statement
If I run the following code it does not recognize several of the numbers in the array, like 0.1, even though it looks like 0.1 is in the array when it is printed.
import numpy as np
pH = 0.1
print(np.linspace(0.0, 2.9, num=30))
if pH in…

Drewsen5
- 1
0
votes
1 answer
Values plotted using linspace plotting the number of samples and not the numbers inside the interval
when I am plotting a graph using linspace for a and b values and plot it, it is plotting the samples along the axis and not the interval. for eg:
a=np.linspace(0,5,100)
b=np.linspace(0,6,100)
what is being plotted is 0-100 for a and b and not 0-5…

Orla
- 11
- 1
-1
votes
2 answers
input numpy array to linspace and for loop range problem
I am having trouble trying to use multiple values to test since linspace and range in for loop is not accepting array as an input.
Here is an example of what I am trying to do:
gp_input = np.array([31,61])
def var_gp(gp):
for i in gp:
x_l…

rjomega
- 11
- 2
-1
votes
2 answers
How to vectorize to remove for loops in Python?
I want to remove the for loops in the following Python code by vectorizing it. I searched the Stack overflow and all over the internet to find a solution to no avail.
for v in range(height):
for u in range(width):
start[v,u,0] = -0.5 + u /…

Richard
- 3
- 1
-1
votes
1 answer
VALUE ERROR: x, y, and format string must not be None
So I'm just trying to produce a Simple graph but i keep getting a value error for some reason, code below
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
time = np.linspace(0,2,500)
pi = np.pi
def y(t):
…

eoinc837
- 1
- 2
-2
votes
1 answer
Linspace in Python?
So I recently saw a post use linspace in Python, is this not a Matlab function? I cannot find it in the docs and was under the impression that the Python alternative for linspace is range. Is it part of some module/library/package?
-2
votes
3 answers
how to create equally spaced numbers between 2 given points
how can i create a number of values between 1000 and 1500 with each value having a difference of 0.0299

Walker
- 19
- 3
-3
votes
1 answer
Matlab- graphing and subplots
I tried to do my homework and i'm not sure if I did it right. I'm not entirely sure how linspace works and was hoping for some input on my code! I'll attach the assignment it's based on. [enter link description here][1]
[enter image description…

Jessica Koval
- 9
- 1