Data scientist at Cohen Veterans Bioscience; Obsessive runner. 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.)

Answered

Check true if value in a matrix is increasing,decreasing or staying same

Use the diff command, and check whether the result is greater than zero, etc.

Check true if value in a matrix is increasing,decreasing or staying same

Use the diff command, and check whether the result is greater than zero, etc.

7 hours ago | 0

| accepted

Answered

Unable to perform assignment because the left and right sides have a different number of elements.

It looks like inside your function, in these lines dS = ((-beta*(B/(B+k))*S(tt) + ub*(S(tt)+I(tt)+R(tt)) - ud*S) * dt)'; dI = ...

Unable to perform assignment because the left and right sides have a different number of elements.

It looks like inside your function, in these lines dS = ((-beta*(B/(B+k))*S(tt) + ub*(S(tt)+I(tt)+R(tt)) - ud*S) * dt)'; dI = ...

20 hours ago | 0

Answered

Invalid Expression with plotting t

Your code works after I fix two typos: dt=0.01; h=0.1; w=0.1; to=2.5; t=0:dt:10; r=h*exp(-((t-to).^2)/w^2); plot(t,r,'b',...

Invalid Expression with plotting t

Your code works after I fix two typos: dt=0.01; h=0.1; w=0.1; to=2.5; t=0:dt:10; r=h*exp(-((t-to).^2)/w^2); plot(t,r,'b',...

22 hours ago | 0

| accepted

Answered

How to use REGRESSION & INTERPOLATION ?

I don't think you need interpolation for this task. Do you have the Statistics and Machine Learning Toolbox? You could fit a no...

How to use REGRESSION & INTERPOLATION ?

I don't think you need interpolation for this task. Do you have the Statistics and Machine Learning Toolbox? You could fit a no...

22 hours ago | 0

Answered

How to have a x-axis with repeating values (non-unique)

I have not seen a plot of this style. It's a bit confusing to me. I'm curious what the color background regimes are. Training, t...

How to have a x-axis with repeating values (non-unique)

I have not seen a plot of this style. It's a bit confusing to me. I'm curious what the color background regimes are. Training, t...

3 days ago | 0

| accepted

Answered

errors using Numerical Integration

I see three errors: (1) You need elementwise division instead of matrix division: y = @(x) 1./(sqrt(1+x.^4)); % note the adde...

errors using Numerical Integration

I see three errors: (1) You need elementwise division instead of matrix division: y = @(x) 1./(sqrt(1+x.^4)); % note the adde...

5 days ago | 1

| accepted

Answered

Uniformly distributed random variables

The main reason your output looks like this is that you are only generating ONE random value for each resistor -- and then recal...

Uniformly distributed random variables

The main reason your output looks like this is that you are only generating ONE random value for each resistor -- and then recal...

5 days ago | 0

Answered

pseudo code for all n values

Assuming that what you wanted was alternating pattern of 1's and 0's, regardless of how large n is, then this should do what you...

pseudo code for all n values

Assuming that what you wanted was alternating pattern of 1's and 0's, regardless of how large n is, then this should do what you...

6 days ago | 1

Answered

How to avoid "doubling up" in a RNG?

Here is one way to do what I think you mean: x = zeros(10,10); % For M and N, select 6 random integers from 1:10. M = randp...

How to avoid "doubling up" in a RNG?

Here is one way to do what I think you mean: x = zeros(10,10); % For M and N, select 6 random integers from 1:10. M = randp...

7 days ago | 1

Answered

Call matlab from STATA

I haven't run MATLAB from the command line in probably 20 years, but I think I would try putting the whole try-catch structure i...

Call matlab from STATA

I haven't run MATLAB from the command line in probably 20 years, but I think I would try putting the whole try-catch structure i...

7 days ago | 0

| accepted

Answered

Save a double array to a text file

Regardless of what is displayed to the MATLAB command window (in your case, the default format, it seems), an array of type doub...

Save a double array to a text file

Regardless of what is displayed to the MATLAB command window (in your case, the default format, it seems), an array of type doub...

7 days ago | 0

Answered

Doubt in a product erro

The reason has to do with the accuracy of floating-point math on a binary computer. I suggest you read this question and answer,...

Doubt in a product erro

The reason has to do with the accuracy of floating-point math on a binary computer. I suggest you read this question and answer,...

8 days ago | 1

Answered

How to only show part of a plot

You can set the axis limits of a plot using the xlim (and ylim and zlim) command. If that is not what you meant, I suggest you ...

How to only show part of a plot

You can set the axis limits of a plot using the xlim (and ylim and zlim) command. If that is not what you meant, I suggest you ...

9 days ago | 0

Answered

using logical functions to display arrays

When x is a vector, then if x < 10 is interpreted as "if all elements of x are less than 10". Your if statement is never enter...

using logical functions to display arrays

When x is a vector, then if x < 10 is interpreted as "if all elements of x are less than 10". Your if statement is never enter...

9 days ago | 0

Answered

Cody Problem 14. Find the numeric mean of the prime numbers in a matrix.

After you correct the problem that @Geoff Hayes pointed out in his comment, you still have a mathematical one. out = sum/2 is ...

Cody Problem 14. Find the numeric mean of the prime numbers in a matrix.

After you correct the problem that @Geoff Hayes pointed out in his comment, you still have a mathematical one. out = sum/2 is ...

10 days ago | 0

Answered

Simpsons rule function error

In this line of code: x=x(1)+h*(2*k-1); you have set x to a scalar value, so when you try to access x(2) in this line of code:...

Simpsons rule function error

In this line of code: x=x(1)+h*(2*k-1); you have set x to a scalar value, so when you try to access x(2) in this line of code:...

12 days ago | 1

| accepted

Answered

What Shall I need to add while calling file having numerical digits (e.g. -1,-2)?

You may want to try the functional form instead. load('Histories/IND.X0kY-1k.CXY.sema'); Also, what variables are in your work...

What Shall I need to add while calling file having numerical digits (e.g. -1,-2)?

You may want to try the functional form instead. load('Histories/IND.X0kY-1k.CXY.sema'); Also, what variables are in your work...

13 days ago | 0

Answered

clustering based on a custom function

I can't say that I have spent enough time with your code to fully understand it. But, I notice the following. Inside the loop o...

clustering based on a custom function

I can't say that I have spent enough time with your code to fully understand it. But, I notice the following. Inside the loop o...

14 days ago | 0

| accepted

Answered

data from one array to another

I can't tell what you intend to get from this expression [x(j),:] which is not valid MATLAB syntax. x(j) is the j-th element o...

data from one array to another

I can't tell what you intend to get from this expression [x(j),:] which is not valid MATLAB syntax. x(j) is the j-th element o...

15 days ago | 0

Answered

How do i get three colums as output?

t = data(:,[93,92,91]); will be the the last three columns from data, in reverse order.

How do i get three colums as output?

t = data(:,[93,92,91]); will be the the last three columns from data, in reverse order.

15 days ago | 1

| accepted

Answered

Placing none NaN values from a matrix to another

A = [NaN NaN NaN 3 0 NaN NaN 1; NaN 2 NaN 6 1 NaN NaN NaN; 5 NaN NaN 2 NaN NaN NaN 1]; B = [ 1 2 3 4 5 6 7 8; 8 7 6 5 4 3 2 1; ...

Placing none NaN values from a matrix to another

A = [NaN NaN NaN 3 0 NaN NaN 1; NaN 2 NaN 6 1 NaN NaN NaN; 5 NaN NaN 2 NaN NaN NaN 1]; B = [ 1 2 3 4 5 6 7 8; 8 7 6 5 4 3 2 1; ...

15 days ago | 0

| accepted

Answered

why i get Array indices must be positive integers or logical values.

In this line z(length(R),length(R)-1) = -R(length(R)-1) if the user enters a resistance vector that is length 1, then you try...

why i get Array indices must be positive integers or logical values.

In this line z(length(R),length(R)-1) = -R(length(R)-1) if the user enters a resistance vector that is length 1, then you try...

15 days ago | 0

| accepted

Answered

Error in code, "Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses. "

You seem to have a rogue t at the end of your expression. If you get rid of that, then ... Td=1/55*(20*pi*sin(1/11*pi*t)+33*exp...

Error in code, "Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses. "

You seem to have a rogue t at the end of your expression. If you get rid of that, then ... Td=1/55*(20*pi*sin(1/11*pi*t)+33*exp...

16 days ago | 0

Answered

Replacing single values in a matrix with 1x09 doubles

I think this does what you want, using a straightforward loop. You could loop this over values of N = 1:6, if what you want to ...

Replacing single values in a matrix with 1x09 doubles

I think this does what you want, using a straightforward loop. You could loop this over values of N = 1:6, if what you want to ...

18 days ago | 1

| accepted

Answered

Unable to perform assignment because the left and right sides have a different number of element

You need to use K(n,:)=A; and L(n,:)=A; to assign the row vector A to a row of K or L. K(n) is a single element, using line...

Unable to perform assignment because the left and right sides have a different number of element

You need to use K(n,:)=A; and L(n,:)=A; to assign the row vector A to a row of K or L. K(n) is a single element, using line...

19 days ago | 1

Answered

un-mix a pdf

I was doing a bit of searching on this forum, and I found this question, where @Image Analyst uploaded his Fit Multiple Gaussian...

un-mix a pdf

I was doing a bit of searching on this forum, and I found this question, where @Image Analyst uploaded his Fit Multiple Gaussian...

19 days ago | 0

Answered

Index exceeds the number of array elements

You have defined C_target as a scalar (i.e. a single value), but you try to access it in the for loop with C_target(i) so when...

Index exceeds the number of array elements

You have defined C_target as a scalar (i.e. a single value), but you try to access it in the for loop with C_target(i) so when...

20 days ago | 0

Answered

Finding sorted rows in a matrix

For my current understanding of what you want, I believe this works: ii = find(diff(outsx,[],2)>=0)

Finding sorted rows in a matrix

For my current understanding of what you want, I believe this works: ii = find(diff(outsx,[],2)>=0)

21 days ago | 1

Answered

Finding sorted rows in a matrix

outsx = [ 1 1 2 1 3 1 1 2 2 2 3 2 1 3 2 3 ...

Finding sorted rows in a matrix

outsx = [ 1 1 2 1 3 1 1 2 2 2 3 2 1 3 2 3 ...

21 days ago | 0

Answered

Will MATLAB function samplesizepwr work with paired t-test

I read through the documentation, and I don't see any mention of calculating power for a paired t-test. Maybe there is a way, bu...

Will MATLAB function samplesizepwr work with paired t-test

I read through the documentation, and I don't see any mention of calculating power for a paired t-test. Maybe there is a way, bu...

21 days ago | 1