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 do you get a specific decimal accuracy with the fprintf function?

Your r variable needs to be a second argument (not using a plus sign as you did). r = pi; fprintf("The estimated principle st...

How do you get a specific decimal accuracy with the fprintf function?

Your r variable needs to be a second argument (not using a plus sign as you did). r = pi; fprintf("The estimated principle st...

ongeveer 7 uur ago | 0

| accepted

Answered

Clustering electricity consumption time series into two customer groups.

I'm actually not sure if there are MATLAB functions that support these analyses, but I think the models you want are known as "L...

Clustering electricity consumption time series into two customer groups.

I'm actually not sure if there are MATLAB functions that support these analyses, but I think the models you want are known as "L...

ongeveer 13 uur ago | 0

Answered

error analysis with errbar function

This section of the documentation explains how to control error bar length in all directions.

error analysis with errbar function

This section of the documentation explains how to control error bar length in all directions.

ongeveer 13 uur ago | 0

Answered

Why doesn't this matlab code work?!

You missed a spot where you needed an element-wise operation, multiplying the exp(x) by the other term: x = -5:1:5; y = exp(x)...

Why doesn't this matlab code work?!

You missed a spot where you needed an element-wise operation, multiplying the exp(x) by the other term: x = -5:1:5; y = exp(x)...

1 dag ago | 0

Answered

Reducing memory of variables

Yes, there are many numeric types that use less memory than a double. Looks like you could use an 8-bit unsigned integer.

Reducing memory of variables

Yes, there are many numeric types that use less memory than a double. Looks like you could use an 8-bit unsigned integer.

1 dag ago | 0

| accepted

Answered

vector with spacing (predefined)

Does v = -25:5:15 do what you want? Or maybe you meant initial_value = -25; step_size = 5; final_value = 15; v = initial...

vector with spacing (predefined)

Does v = -25:5:15 do what you want? Or maybe you meant initial_value = -25; step_size = 5; final_value = 15; v = initial...

2 dagen ago | 0

Answered

Can someone please help me stop "Index exceeds array bounds." in iteration? Any help is highly appreciated.

In your for loop, when n==5, your code tries to execute x1(n-1) which is x1(4) But your vector x1 is length 3, so there is n...

Can someone please help me stop "Index exceeds array bounds." in iteration? Any help is highly appreciated.

In your for loop, when n==5, your code tries to execute x1(n-1) which is x1(4) But your vector x1 is length 3, so there is n...

3 dagen ago | 0

Answered

How to remove space between bars in bar graph for unequally spaced data?

To me, it seems like a bad idea to make the bars evenly spaced, if the data are not from evenly spaced years. If the x-axis repr...

How to remove space between bars in bar graph for unequally spaced data?

To me, it seems like a bad idea to make the bars evenly spaced, if the data are not from evenly spaced years. If the x-axis repr...

3 dagen ago | 0

Answered

M-point averaging filter

You should be able to use the movmean function. For example: % Define some data A = reshape(1:15,3,5); % Take the moving av...

M-point averaging filter

You should be able to use the movmean function. For example: % Define some data A = reshape(1:15,3,5); % Take the moving av...

4 dagen ago | 0

| accepted

Answered

How to get a license?

The starting point for acquiring a campus-wide license is here. To find MATLAB options for yourself, click on the Get MATLAB bu...

How to get a license?

The starting point for acquiring a campus-wide license is here. To find MATLAB options for yourself, click on the Get MATLAB bu...

4 dagen ago | 1

Answered

convert to cell array

You can probably use the datevec function datevec('19:33:02.58')

convert to cell array

You can probably use the datevec function datevec('19:33:02.58')

5 dagen ago | 0

Answered

I have calculated Kupec's POF at 95% and 99% confidence levels. Under the 'Test level' column at last, all the values appear as 0.95. Shouldn't the values at 99% confidence level be 0.99? Please help.

The value-at-risk level and the confidence level at which you test that level, are two different things. You can prove that for...

I have calculated Kupec's POF at 95% and 99% confidence levels. Under the 'Test level' column at last, all the values appear as 0.95. Shouldn't the values at 99% confidence level be 0.99? Please help.

The value-at-risk level and the confidence level at which you test that level, are two different things. You can prove that for...

5 dagen ago | 0

Answered

How do I create a box in Matlab?

I don't think the box command does what you think it does. Maybe you intended rectangle?

How do I create a box in Matlab?

I don't think the box command does what you think it does. Maybe you intended rectangle?

6 dagen ago | 0

Answered

How to add each column of matrix A with another matrix B?

I think this does what you want: % Input data A = [1 20; 3 40]; B = [5 6 7; 8 9 10]; % Algorithm: % (1) Permu...

How to add each column of matrix A with another matrix B?

I think this does what you want: % Input data A = [1 20; 3 40]; B = [5 6 7; 8 9 10]; % Algorithm: % (1) Permu...

6 dagen ago | 0

| accepted

Answered

Factorial(1000) as number

The largest finite floating-point number in double precision is realmax For reference factorial(170) and factorial(171) Of...

Factorial(1000) as number

The largest finite floating-point number in double precision is realmax For reference factorial(170) and factorial(171) Of...

6 dagen ago | 0

Answered

Array indices must be positive integers or logical values.

Your variable A is the image data. Your variable t is the value of the image data at the (x,y) coordinate. That value of t coul...

Array indices must be positive integers or logical values.

Your variable A is the image data. Your variable t is the value of the image data at the (x,y) coordinate. That value of t coul...

7 dagen ago | 0

| accepted

Answered

Inconsistency of angle function in finding angle of vectors

I would not characterize this as an inconsistency, so much as a convention to report the value in the range [-pi,pi], rather tha...

Inconsistency of angle function in finding angle of vectors

I would not characterize this as an inconsistency, so much as a convention to report the value in the range [-pi,pi], rather tha...

8 dagen ago | 0

| accepted

Answered

How to Apply PCA Corrrect way

Your question, especially when you ask about the 88x88 matrix that is output from pca(), indicates that you don't really underst...

How to Apply PCA Corrrect way

Your question, especially when you ask about the 88x88 matrix that is output from pca(), indicates that you don't really underst...

8 dagen ago | 0

| accepted

Answered

How can I fit Bessel function of 1st kind with the scatter plot?

I don't have the Curve Fitting Toolbox, so I cannot help with that. However, I used fitnlm, and I see a couple strange things a...

How can I fit Bessel function of 1st kind with the scatter plot?

I don't have the Curve Fitting Toolbox, so I cannot help with that. However, I used fitnlm, and I see a couple strange things a...

8 dagen ago | 0

| accepted

Answered

plot (t,y) ,dimension failure

The answer is right there in the error message. Use elementwise multiplication instead of matrix multiplication. clear all; clo...

plot (t,y) ,dimension failure

The answer is right there in the error message. Use elementwise multiplication instead of matrix multiplication. clear all; clo...

8 dagen ago | 1

| accepted

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.

11 dagen 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 = ...

11 dagen 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',...

11 dagen 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...

11 dagen 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...

13 dagen 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...

15 dagen 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...

15 dagen 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...

16 dagen 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...

17 dagen 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...

17 dagen ago | 0

| accepted