Questions tagged [linspace]

56 questions
1
vote
1 answer

When plotting a np.linspace the figure labeling is not what I wanted

I want to animate julia sets. Anyways everything works so far, I only need to change the axis labeling. When plotting my values the x- and y axis are both showing the 500x500 linspace. Id rather like to see the [-1,1]x[-1,1] Intervall ive defined…
1
vote
1 answer

Error using linspace (line 22) Inputs must be scalars

I'm working on fitting a model to data I have collected. Within the model, I identify the optimal parameter values that best fit participant data then adjust and reduce the viewing window (range) to get more precise parameter values. I'm using…
1
vote
2 answers

"numpy.linspace" for second time after excluding some point by first "linspace"

I am building a model and I need to get the positions of some points inside a box (known volume). I am thinking on using a) numpy.linspace(start,stop,30) b) numpy.linspace(start,stop,3000) from the same box, I think I need a tool to exclude the…
1
vote
1 answer

Unable to use for loop for plotting via matplotlib in python for decimal values

a=np.linspace(0.03,0.05,5) b=np.linspace(-0.01,0.01,200) c= [] for i in np.arange(a[0],a[4]): #first for loop to print a for j in range(b[0],b[199]): #second for loop to print b print j print i #But I am not getting correct values as…
1
vote
4 answers

Is there a similar function in Excel to that of linspace in Matlab?

In Excel, I need to linearly divide 'X' number of cells from value 'A' to value 'B' in 'i' step value. Ideally, I want to achieve the same result as if I was using the linspace function in Matlab.
1
vote
2 answers

Rcpp code for "linspace" function: vector length incorrect when increment 1e-5

I want to write a function like "linspace" to create equal interval vectors in R with Rcpp. num_dis here is the number of intervals I want for that vector, i.e., a=0,b=10,num_dis = (10-0)/(1e-5)+1=1000001. When I put linspace(0,10,1000001), the…
Kevin
  • 17
  • 4
1
vote
1 answer

How to remove marker from plot and make it smooth

I have been trying to plot a smooth graph, and here is my code import matplotlib.pyplot as plt #fig,axes= plt.subplots(nrows=6, ncols=1, squeeze=False) x = df["DOY"] y = df["By"] z = df["Bz"] a = df["Vsw"] b = df["Nsw"] c =…
Prater
  • 107
  • 1
  • 8
1
vote
1 answer

Eigen Dynamic-sized matrix verticaly/horizontaly Linspaced?

I'm currently working on a project where i need to be able to create matrix such as : MatrixXi lin_spaced_horizontaly = 0 1 2 3 4 ... ncols 0 1 2 3 4 ... ncols 0 1 2 3 4 ... ncols MatrixXi lin_spaced_verticaly = 0 0 0 1 1 1 2 2 2 3 3 3 4 4…
NzPierre
  • 119
  • 1
  • 5
1
vote
0 answers

curve_fit impossible if the function calls minimize

Say I have a function f1, of an independent variable x and a parameter a. The function f1, in turn, needs a parameter m that can be obtained minimizing a second function f2, and this function needs the variable x as a parameter. I have no problem…
alessandro
  • 3,838
  • 8
  • 40
  • 59
0
votes
1 answer

Python, interleaving two or more linspace arrays

I have three linspace arrays of equal length: a, b, and c. I want to interleave the arrays together in the following way. ([a[0], b[0], c[0]], [a[1], b[1], c[1]], [a[2], b[2], c[2]], . . . etc.) I've seen numerous examples of interleaving two or…
cat_herder
  • 51
  • 6
0
votes
0 answers

TypeError: 'float' object cannot be interpreted as an integer on linspace

TypeError Traceback (most recent call last) d:\website\SpeechProcessForMachineLearning-master\SpeechProcessForMachineLearning-master\speech_process.ipynb Cell 15' in () -->1 plot_freq(signal,…
0
votes
1 answer

Create a dictionary with multiple keys and store multiple values to it

I have a grid that has x and y coordinates. Now for each grid point I would like to assign multiple values(everything works in loop) Suppose coordinates of x vary from 0 to 10 and y from 0 to 10(Increment of 1) and I have three values which I will…
Yash54
  • 3
  • 2
0
votes
0 answers

Linspace give not exact float

I am trying to define a time vector which is evenly spaced with the numpy linspace function. It looks as following: t_start = 0 t_end = 0.0032768 # in seconds, equals 3.2768ms samples = 32768 time = np.linspace(t_start, t_end, samples,…
lmixa
  • 49
  • 5
0
votes
1 answer

How to vectorized version of this code using np.meshgrid and np.linspace

How can I write a vectorized version of this code cell below? The code should be fully vectorized, with no for-loops, using np.meshgrid and np.linspace? def eval_on_grid_unvectorized(func, extent, numsteps): """Evaluates func(x1, x2) for each…
Joy
  • 75
  • 1
  • 6
0
votes
1 answer

How do I create a better resolution on my plot with linspace?

i need to create a higher resolution of my plot with the linspace function but i can't figure out how to implement it into my code. Maybe someone has a better understanding of this and can help me. import numpy as np import matplotlib.pyplot as…
Cyanor
  • 3
  • 3