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

How I plot this ?

You can use the fimplicit function. alpha1=0.1; alpha2=0.2; beta1=0.2; beta2=1; gamma=1.3; f = @(x,y) log((1+alpha1*x./(1+alph...

How I plot this ?

You can use the fimplicit function. alpha1=0.1; alpha2=0.2; beta1=0.2; beta2=1; gamma=1.3; f = @(x,y) log((1+alpha1*x./(1+alph...

alrededor de 4 horas ago | 0

Answered

How I plot this ?

Here is one way: alpha1=0.1; alpha2=0.2; beta1=0.2; beta2=1; gamma=1.3; x = 0 : 0.1 : 10; y = 0 : 0.1 : 10; [xx,yy] = me...

How I plot this ?

Here is one way: alpha1=0.1; alpha2=0.2; beta1=0.2; beta2=1; gamma=1.3; x = 0 : 0.1 : 10; y = 0 : 0.1 : 10; [xx,yy] = me...

alrededor de 5 horas ago | 1

| accepted

Answered

Adding 2 string row to beginning row and end row of a matrix

A numeric data type cannot hold text. You'll need to store your data in a variable that can hold mixed types. One possibility is...

Adding 2 string row to beginning row and end row of a matrix

A numeric data type cannot hold text. You'll need to store your data in a variable that can hold mixed types. One possibility is...

alrededor de 6 horas ago | 0

| accepted

Answered

For the following code, It shows my 51 iterations, however i only want to display the last iteration

Looks like you could just pull these lines out, and put them after the end statement of the loop: disp(['Error as percentage: '...

For the following code, It shows my 51 iterations, however i only want to display the last iteration

Looks like you could just pull these lines out, and put them after the end statement of the loop: disp(['Error as percentage: '...

alrededor de 10 horas ago | 0

Answered

Concatenate vertically multiple tables with different dimensions

You can do this with the outerjoin command: A = table([1001; 1002; 1003],{'Jones';'James';'Robert'},... 'VariableNames...

Concatenate vertically multiple tables with different dimensions

You can do this with the outerjoin command: A = table([1001; 1002; 1003],{'Jones';'James';'Robert'},... 'VariableNames...

1 día ago | 0

| accepted

Answered

Standard deviation of values with standard deviation

The question you are asking is a specific instance of "propagation of uncertainty". You might want to learn more about the topic...

Standard deviation of values with standard deviation

The question you are asking is a specific instance of "propagation of uncertainty". You might want to learn more about the topic...

1 día ago | 2

| accepted

Answered

How to remove elements from two arrays when one of them has a zero

idx_to_remove = target_2019==0; target_2019(idx_to_remove) = []; output_2019(idx_to_remove) = [];

How to remove elements from two arrays when one of them has a zero

idx_to_remove = target_2019==0; target_2019(idx_to_remove) = []; output_2019(idx_to_remove) = [];

1 día ago | 1

Answered

Put specific name in file via writematrix

You need to concatenate the character arrays. Here is one way to do that: str='2020' writematrix(A,['output',str,'.xlsx'])

Put specific name in file via writematrix

You need to concatenate the character arrays. Here is one way to do that: str='2020' writematrix(A,['output',str,'.xlsx'])

5 días ago | 0

| accepted

Answered

Displaying a group of vectors on separate lines

You can use a semicolon to concatenate vertically [a; b; c]

Displaying a group of vectors on separate lines

You can use a semicolon to concatenate vertically [a; b; c]

6 días ago | 0

Answered

Issues converting a Cell to a numerical array

Here is one way that may work for you: C = {1, 3, 7, 7, 'a'}; N = cell2mat(C(cellfun(@isnumeric,C)))

Issues converting a Cell to a numerical array

Here is one way that may work for you: C = {1, 3, 7, 7, 'a'}; N = cell2mat(C(cellfun(@isnumeric,C)))

8 días ago | 0

Answered

3D Matrix Multiplication

You can do it straightforwardly with a for loop: % Some made-up input data A = rand(3,1,4); B = rand(3,3,4); [mA,nA,pA] = ...

3D Matrix Multiplication

You can do it straightforwardly with a for loop: % Some made-up input data A = rand(3,1,4); B = rand(3,3,4); [mA,nA,pA] = ...

8 días ago | 0

| accepted

Answered

fitlm() with 0 intercept function returns different values for R2 betwen MATLAB 2020a and 2020b?

Interesting. The 2020b result seems to be correct, based on the formula using sums of squares. (See, e.g. the definition on wiki...

fitlm() with 0 intercept function returns different values for R2 betwen MATLAB 2020a and 2020b?

Interesting. The 2020b result seems to be correct, based on the formula using sums of squares. (See, e.g. the definition on wiki...

9 días ago | 1

| accepted

Answered

Creating a Histogram of Letter grades converted from number grades

I'm sorry to say that the approach in your code is so misguided, that it is probably not worth debugging it. You need a differen...

Creating a Histogram of Letter grades converted from number grades

I'm sorry to say that the approach in your code is so misguided, that it is probably not worth debugging it. You need a differen...

9 días ago | 0

Answered

how to get random pair ?

How are these pairs currently stored? This seems equivalent to just choosing a random number from 1-6, so you could do idx = r...

how to get random pair ?

How are these pairs currently stored? This seems equivalent to just choosing a random number from 1-6, so you could do idx = r...

9 días ago | 0

Answered

How to plot function with variable input like shown in figure?

I didn't fully understand what you are trying to do, but the fplot command might be useful.

How to plot function with variable input like shown in figure?

I didn't fully understand what you are trying to do, but the fplot command might be useful.

10 días ago | 0

Answered

Producing a NaN only where there is a NaN, zero otherwise

Second attempt ... X = [-inf, -1, -eps, 0, realmin, 2, 1+i, pi, flintmax, realmax, inf, NaN]; broken = @(x) 0./(isnan(x)-1); %...

Producing a NaN only where there is a NaN, zero otherwise

Second attempt ... X = [-inf, -1, -eps, 0, realmin, 2, 1+i, pi, flintmax, realmax, inf, NaN]; broken = @(x) 0./(isnan(x)-1); %...

10 días ago | 1

Answered

Producing a NaN only where there is a NaN, zero otherwise

First attempt: X = [-inf, -1, -eps, 0, realmin, 2, 1+i, pi, flintmax, realmax, inf, NaN]; broken = @(x) 1./((isnan(x)-1)/0); %...

Producing a NaN only where there is a NaN, zero otherwise

First attempt: X = [-inf, -1, -eps, 0, realmin, 2, 1+i, pi, flintmax, realmax, inf, NaN]; broken = @(x) 1./((isnan(x)-1)/0); %...

10 días ago | 1

Answered

How do I remove NaN's from my data?

If your numeric vector is called "x", then x(isnan(x)) = []; will remove the NaN values.

How do I remove NaN's from my data?

If your numeric vector is called "x", then x(isnan(x)) = []; will remove the NaN values.

11 días ago | 0

Answered

Plot of 4D coordinates

You may be able to find something you can adapt at the MATLAB Plot Gallery.

Plot of 4D coordinates

You may be able to find something you can adapt at the MATLAB Plot Gallery.

11 días ago | 0

Answered

How to get the first value in a set of array that is bigger than the first few values?

Because x and y are not the same length, I'm not sure how to make the "correspondence" between them. However, this code snippet ...

How to get the first value in a set of array that is bigger than the first few values?

Because x and y are not the same length, I'm not sure how to make the "correspondence" between them. However, this code snippet ...

12 días ago | 1

Answered

Using if condition store values in an array

If I understand you correctly, this does what you want. (It doesn't directly use "if", but does the job via logical indexing ins...

Using if condition store values in an array

If I understand you correctly, this does what you want. (It doesn't directly use "if", but does the job via logical indexing ins...

13 días ago | 0

| accepted

Answered

Sort an Array with sortrows ( ) with two columns

See my answer (and other comments) to this very similar question. (As with the comments above, the premise is that the displayed...

Sort an Array with sortrows ( ) with two columns

See my answer (and other comments) to this very similar question. (As with the comments above, the premise is that the displayed...

13 días ago | 1

Answered

How to make slope 1in fitlm?

I don't believe you can do it with fitlm, but you can with fitnlm: % Set seed for reproducibility rng default % Make up som...

How to make slope 1in fitlm?

I don't believe you can do it with fitlm, but you can with fitnlm: % Set seed for reproducibility rng default % Make up som...

13 días ago | 0

| accepted

Answered

Multiplying a Matrix with every column of another matrix

Do you mean you just want to do standard matrix multipication? C = A * B Or did I misunderstand?

Multiplying a Matrix with every column of another matrix

Do you mean you just want to do standard matrix multipication? C = A * B Or did I misunderstand?

14 días ago | 1

| accepted

Answered

How to remove this error?

We can't really answer that for you, because we need more information. Suppose x = [1 2 3 4]; y = [5 6 2 3]; If I want to pl...

How to remove this error?

We can't really answer that for you, because we need more information. Suppose x = [1 2 3 4]; y = [5 6 2 3]; If I want to pl...

14 días ago | 0

Answered

What is prodofsize?

It is mentioned in the "Backward Compatibility" section of the documentation of cellfun, although there doesn't seem to be any i...

What is prodofsize?

It is mentioned in the "Backward Compatibility" section of the documentation of cellfun, although there doesn't seem to be any i...

15 días ago | 0

| accepted

Answered

Array indices must be positive integers or logical values error

You need X = (2*r2*((cosd(0)*cosd(theta2)))); instead of X = (2*r2((cosd(0)*cosd(theta2)))); (Note that I used r2* instead o...

Array indices must be positive integers or logical values error

You need X = (2*r2*((cosd(0)*cosd(theta2)))); instead of X = (2*r2((cosd(0)*cosd(theta2)))); (Note that I used r2* instead o...

15 días ago | 0

Answered

How to insert multiple element after specific numbers in a vector?

Here is one way % Original logical vector input L = logical([1 0 1 1 0]); % The numbers to be inserted oneNum = 6; zeroNu...

How to insert multiple element after specific numbers in a vector?

Here is one way % Original logical vector input L = logical([1 0 1 1 0]); % The numbers to be inserted oneNum = 6; zeroNu...

18 días ago | 0

Answered

Addition in 3D matrix

% Define some pretend data, the size of your original matrix M = rand(62,50,341); % Intervals interval = [8,30,31,31,30,31,...

Addition in 3D matrix

% Define some pretend data, the size of your original matrix M = rand(62,50,341); % Intervals interval = [8,30,31,31,30,31,...

18 días ago | 0

Answered

Shifting columns in matrix Matlab

Slightly simpler version of @Nora Khaled's idea. It will also generalize to an (N-1) X N array in a way that I believe makes sen...

Shifting columns in matrix Matlab

Slightly simpler version of @Nora Khaled's idea. It will also generalize to an (N-1) X N array in a way that I believe makes sen...

20 días ago | 0

| accepted