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

Find indexes according to a value in array

Dare I say obviously, A can't obey both the conditions simultaneously. You need to find the indices separately. [find(A<=x,1,'l...

Find indexes according to a value in array

Dare I say obviously, A can't obey both the conditions simultaneously. You need to find the indices separately. [find(A<=x,1,'l...

1 day ago | 0

| accepted

Answered

error while using Operands

Here's what is means: true && true; % This works, and gives a scalar result [true true] && [true false]; % This gives the er...

error while using Operands

Here's what is means: true && true; % This works, and gives a scalar result [true true] && [true false]; % This gives the er...

1 day ago | 0

Answered

How to correct matrix dimension disagree error

You are effectively trying to do this operation in your code: n * u where n is a 1x4 matrix, and u is a 1x100 matrix. That wo...

How to correct matrix dimension disagree error

You are effectively trying to do this operation in your code: n * u where n is a 1x4 matrix, and u is a 1x100 matrix. That wo...

2 days ago | 0

Answered

Select specific cells from a cell array and create a seperate vector

Does your cell array have only numeric values in it? If yes, then maxVal = max(cell2num(C),[],3) where C is your cell array.

Select specific cells from a cell array and create a seperate vector

Does your cell array have only numeric values in it? If yes, then maxVal = max(cell2num(C),[],3) where C is your cell array.

2 days ago | 0

| accepted

Answered

How to create a plot of the spread of the data

Does using subplots help show your point better? % Load the data load Data1.mat % Convert from table to numeric Data = tab...

How to create a plot of the spread of the data

Does using subplots help show your point better? % Load the data load Data1.mat % Convert from table to numeric Data = tab...

3 days ago | 0

Solved

Say something funny

Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

3 days ago

Answered

set default line marker symbol

See this answer from Mathworks support.

set default line marker symbol

See this answer from Mathworks support.

3 days ago | 1

| accepted

Answered

how to find the Reverse process of A(B).

C = [9 4 2 1 7 6 8 5 3 8 11]; A(B) = C

how to find the Reverse process of A(B).

C = [9 4 2 1 7 6 8 5 3 8 11]; A(B) = C

3 days ago | 1

Answered

How do I find the column of maximum values of a maxtrix?

Here is one way to do it. [~,linearIndex] = max(x,[],'all','linear'); % First, find the *linear* index of x [rowIndex,colIndex...

How do I find the column of maximum values of a maxtrix?

Here is one way to do it. [~,linearIndex] = max(x,[],'all','linear'); % First, find the *linear* index of x [rowIndex,colIndex...

4 days ago | 0

Answered

How can I do polynomial fitting when X-axis is time

Hm. Plotting the data you posted, using the seconds function, results in exactly what I would expect -- including capturing the ...

How can I do polynomial fitting when X-axis is time

Hm. Plotting the data you posted, using the seconds function, results in exactly what I would expect -- including capturing the ...

4 days ago | 0

Answered

Get the diagonal without calculating the explicit matrix

Here is one way: % Make up some inputs N = 4; B = rand(N); C = rand(N); % Calculate the diagonal A_diag = 0; for nr = 1...

Get the diagonal without calculating the explicit matrix

Here is one way: % Make up some inputs N = 4; B = rand(N); C = rand(N); % Calculate the diagonal A_diag = 0; for nr = 1...

5 days ago | 1

Answered

Find the sum of the vector using a for loop

If you type the expression 50:1 into MATLAB, you will get the result >> 50:1 ans = 1×0 empty double row vector So, y...

Find the sum of the vector using a for loop

If you type the expression 50:1 into MATLAB, you will get the result >> 50:1 ans = 1×0 empty double row vector So, y...

5 days ago | 0

Answered

Index exceeds the number of array elements (1)

You didn't answer Ameer's first question, but it seems clear that when you call the function diggerangle(L_12, L_23, L_13, x) %...

Index exceeds the number of array elements (1)

You didn't answer Ameer's first question, but it seems clear that when you call the function diggerangle(L_12, L_23, L_13, x) %...

6 days ago | 1

Answered

How to write a custom non linear function for data fitting?

I don't have the Curve Fitting Toolbox, so I can't really comment on your current code. But, if you also have the Statistics and...

How to write a custom non linear function for data fitting?

I don't have the Curve Fitting Toolbox, so I can't really comment on your current code. But, if you also have the Statistics and...

7 days ago | 1

Answered

Plot and fit exponential decay probability of population

You are correct to use the ecdf function. I think the piece you are missing is the use of the 'censoring' input. Take a look at ...

Plot and fit exponential decay probability of population

You are correct to use the ecdf function. I think the piece you are missing is the use of the 'censoring' input. Take a look at ...

8 days ago | 0

| accepted

Answered

matlab gives wrong answer to determinant of a 3x3 matrix

MATLAB gives the correct result to within the limits of double-precision floating-point arithmetic. This is a very common quest...

matlab gives wrong answer to determinant of a 3x3 matrix

MATLAB gives the correct result to within the limits of double-precision floating-point arithmetic. This is a very common quest...

8 days ago | 1

Answered

How do I print unknown values

vectorA = [2 3 5 7]; ['Vector A is: [',sprintf('%6.3f', vectorA),']']

How do I print unknown values

vectorA = [2 3 5 7]; ['Vector A is: [',sprintf('%6.3f', vectorA),']']

9 days ago | 0

| accepted

Answered

How to fit multiple peaks using Gaussian funtion

Never this the original of this question, but saw the comment. If you have the Statistics and Machine Learning Toolbox, I belie...

How to fit multiple peaks using Gaussian funtion

Never this the original of this question, but saw the comment. If you have the Statistics and Machine Learning Toolbox, I belie...

9 days ago | 0

Answered

Hyerbolic Functions causing issues with Contour Plots.

I ran the following code k = 0.5; l = 0.5; k1=((k+(1/2))*pi)^4; l1=((l+(1/2))*pi)^4; v1 = @(x,y) cos(k1*x)-cosh(k1*x)-(...

Hyerbolic Functions causing issues with Contour Plots.

I ran the following code k = 0.5; l = 0.5; k1=((k+(1/2))*pi)^4; l1=((l+(1/2))*pi)^4; v1 = @(x,y) cos(k1*x)-cosh(k1*x)-(...

10 days ago | 0

Answered

make rectangular with vectors

You say that you have a problem with "one" of your lines, but I think you have a deeper conceptual problem with how you tried to...

make rectangular with vectors

You say that you have a problem with "one" of your lines, but I think you have a deeper conceptual problem with how you tried to...

10 days ago | 1

| accepted

Answered

what is wrong with my code, i am trying to plot below

FYI, there is a much more efficient solution, which is to avoid the for loop altogether: t = 1:.01:10; x = zeros(size(t)); ...

what is wrong with my code, i am trying to plot below

FYI, there is a much more efficient solution, which is to avoid the for loop altogether: t = 1:.01:10; x = zeros(size(t)); ...

10 days ago | 0

Answered

what is wrong with my code, i am trying to plot below

In every iteration of the for loop, you are simply overwriting x, over and over. Instead, you need to define a vector for x, to...

what is wrong with my code, i am trying to plot below

In every iteration of the for loop, you are simply overwriting x, over and over. Instead, you need to define a vector for x, to...

10 days ago | 0

| accepted

Answered

whats wrong with my code?

He wrote dx = [0]; and you wrote dx[0];

whats wrong with my code?

He wrote dx = [0]; and you wrote dx[0];

10 days ago | 1

| accepted

Answered

Save image containing plotted lines

I would expect print('-dpng','-r600','HoughLines.png') to work. You could also try the export_fig utility from the File Excha...

Save image containing plotted lines

I would expect print('-dpng','-r600','HoughLines.png') to work. You could also try the export_fig utility from the File Excha...

11 days ago | 0

Answered

How to save any trained machine learning model to use it for prediction later?

The standard calling syntax, e.g. Mdl = fitrensemble(Tbl,ResponseVarName); stores everything you need in the model object name...

How to save any trained machine learning model to use it for prediction later?

The standard calling syntax, e.g. Mdl = fitrensemble(Tbl,ResponseVarName); stores everything you need in the model object name...

12 days ago | 0

| accepted

Answered

Perform inverse of each double within a cell

Why do you think you cannot use cellfun? Period = {[2 3; 5 7],[11 13]}; Frequency = cellfun(@(x)1./x,Period,'UniformOutput',...

Perform inverse of each double within a cell

Why do you think you cannot use cellfun? Period = {[2 3; 5 7],[11 13]}; Frequency = cellfun(@(x)1./x,Period,'UniformOutput',...

12 days ago | 0

| accepted

Answered

factoran Error, "Some columns of the X matrix are constant."

You've asked questions about three errors: some columns of the X matrix are constant the number of factors requested, M, is to...

factoran Error, "Some columns of the X matrix are constant."

You've asked questions about three errors: some columns of the X matrix are constant the number of factors requested, M, is to...

12 days ago | 0

Answered

How can I generate a random number from a chi square distribution?

If you have the Statistics and Machine Learning Toolbox, you can use the randsample command to do weighted probabilities. In the...

How can I generate a random number from a chi square distribution?

If you have the Statistics and Machine Learning Toolbox, you can use the randsample command to do weighted probabilities. In the...

15 days ago | 0