Community Profile # the cyclist

### No strings on me

Last seen: Today Active since 2011

Obsessive runner. Flâneur. Professional Interests: Predictive modeling, statistics. (I don't respond to email via author page, but will usually look at a question if you send me a link to it.)

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

How can I find the average of several lines whose datasets are different lengths?
One possible solution would be to interpolate (e.g. with spline function) using the interp1 function, to a common grid of points...

17 minutes ago | 0

Why do I receive "Index exceeds the number of array elements (1)" ?
m is a scalar -- the length of the vector x, plus one. You try to index into it as if it is a vector, for example in the expres...

19 hours ago | 0

| accepted

Normalize unit vector to single didgit integers
Does the following do what you want? f = @(t) round(t/abs(min(t))); f([ 0.4 -0.4 0.8]) f([ 0.123 0.123 .5]) It gives a dif...

20 hours ago | 0

VPA error Index exceeds number of array elements
I'm confused, because the code you posted runs fine: syms t P(t)= 30/(3+7*exp((-.03*t))) P(1960) vpa(P(1960)) Is it possibl...

21 hours ago | 0

How can I solve this error?
When defining a function using that syntax, it has to appear inside a file, for example a text file with the name GRxx_P8_E1.m ...

1 day ago | 0

| accepted

How to plot binary matrix as dots?
M = magic(7); B = M > mean(M); colormap('gray') imagesc(B) axis square

1 day ago | 0

Interpolation of (multidimensional) array
So, this is a somewhat strange "interpolation" (and extrapolation) problem. It requires certain assumptions to leap from your da...

1 day ago | 0

| accepted

multiplication of empty 0X0 double and scalar (1X1)
One possible solution is to use a try-catch structure. The "try" block will be the code that is generally executed, but if that ...

1 day ago | 0

operations on two different matrices
Suppose ... m = 3; n = 4; A = magic(m) B = magic(n) The first row of A is a 1x3 row vector, and the first row of B is a 1...

2 days ago | 0

How to find correlations between a vector and a 3D array and plot the correlations spatially?
Is it correct that the result will be a 120x120 array of correlations, where each entry is the correlation of the 50 isotope val...

2 days ago | 1

How to randomly change element of matrix?
I'll illustrate for an nxn where n = 3, and repeat 2 times: % Set the random number generator seed, for repeatability here rng...

2 days ago | 1

| accepted

I want to remove the blank space between the first two bars and the last two bars. Can anyone help please?
Instead of using the dates in x1 to define the bar positions along the X axis, you could use h1=bar(M1); % instead of h1=bar(x1...

2 days ago | 0

| accepted

Matlab only calculates values for only certain inputs in a matrix.
Several thoughts: First When you write convof = 1/x you need to realize that x is a vector. I think you intended for i=1:10...

3 days ago | 0

stop execution of code to check results
One way would be to use the debugger, specifically a conditional breakpoint.

5 days ago | 0

How to know which distribution is BCa method form bootci assuming my data follows
I don't have a definitive answer, but looking inside the code of bootci.m (by using edit bootci), I see enough usage of norminv ...

5 days ago | 0

trying to put 2 numbers in the a single array repeated the same amount of times and get a sum that adds both of them up
There are several ways to do this in MATLAB. Take a look at the repmat and repelem functions. If you get the array defined corr...

5 days ago | 1

vpa Does Not Show the Required Number of Significant Digits
I'd have to spend more time to figure out the truly complete answer to this, but I'm confident that the reason is that the MATLA...

5 days ago | 1

Correlation coefficient between three column vectors
You should read the documentation, to determine whether a function does what you need. But I think you probably actually want c...

6 days ago | 1

Plotting 4D matrix in 2D space
You are using the plot command in a way that you wish it worked, without carefully understanding how the syntax actually works. ...

6 days ago | 0

How to correctly plot the error of a numerical algorithm ?
You can use the semilogy function instead of the plot function..

6 days ago | 0

| accepted

Search a date from a datetime to another with different length
The result of the operation A(i,1)==B(:,1) is a vector, as is the result of the other equality check you do. You can only use ...

7 days ago | 1

| accepted

how to adjust bar width (absolute value)?
I would point out that in one sense, your bars are the same width -- they both extend one unit (e.g. from 1.5 to 2.5). The reaso...

7 days ago | 0

| accepted

Arrow of a vector ( r, theta) from a point (x,y).
You can make an arrow on a plot using the annotation function, or you may want to use a quiver plot if you want the arrow to com...

7 days ago | 1

How to find all possible combinations between the numbers of two vectors where order does matter
I expect there is a more efficient way, but I think this will do what you want. a = [1 2 3 4]; b = [2 4]; c = unique([combv...

7 days ago | 0

| accepted

Why this code the given error?
CVX is a third-party MATLAB toolbox (i.e. not from MathWorks), that you need to install according to their instructions. You nee...

8 days ago | 0

| accepted

How can I read specific data from excel with multiple sheets?
My first choice for reading data from Excel is usually the readtable function. It has many options for pulling data from individ...

10 days ago | 0

| accepted

How to Normalize a Histogram without using fitdist and pdf or any other fitting functions?
Use the 'Normalization' Name-Value pair to the histogram function: x_values = 0:0.01:5; xx_values = 0:0.01:5; data1 = load('3...

10 days ago | 0

| accepted

Why LSTM training is not done properly?
I doubt that it is actually the size of the data that is the problem. You could test that idea by running the second year (whic...

11 days ago | 0

Check if a script has been run during this session
Your command history is stored in an XML file, in your preferences directory. See this question/answer for details.

12 days ago | 1

| accepted