Answered

What is the solution for "Error using griddedInterpolant The grid vectors must contain unique points."

You're interpolating based on the gridpoints located in column J of your Excel file. Each gridpoint must be unique (i.e., differ...

What is the solution for "Error using griddedInterpolant The grid vectors must contain unique points."

You're interpolating based on the gridpoints located in column J of your Excel file. Each gridpoint must be unique (i.e., differ...

6 months ago | 1

| accepted

Answered

Solving nonlinear equations that include integrals with embedded variables

Your call to fsolve: fsolve('LD', UnknownGuess, options, I, P, n, Mo, l, E) Your function syntax for LD: Eq = LD(Unknown, I, ...

Solving nonlinear equations that include integrals with embedded variables

Your call to fsolve: fsolve('LD', UnknownGuess, options, I, P, n, Mo, l, E) Your function syntax for LD: Eq = LD(Unknown, I, ...

6 months ago | 0

| accepted

Answered

create Continuous sine wave with fixed frequency

freq = 0.2; % freqeuency of sine wave (pick whatever you want) T0 = 200; % period sine wave starts T1 = 240; % period sine...

create Continuous sine wave with fixed frequency

freq = 0.2; % freqeuency of sine wave (pick whatever you want) T0 = 200; % period sine wave starts T1 = 240; % period sine...

6 months ago | 0

| accepted

Answered

how to Write all Variables in workspace into excel ?

The easiest way is probably to put everything into a cell array and then write it to a .xls file using writecell. The question t...

how to Write all Variables in workspace into excel ?

The easiest way is probably to put everything into a cell array and then write it to a .xls file using writecell. The question t...

6 months ago | 0

| accepted

Answered

Plot a a matrix by columns but with a different marker for the data at its end

figure hold on % we need this so that successive plotting commands don't overwrite the previous ones % only plot error bars ...

Plot a a matrix by columns but with a different marker for the data at its end

figure hold on % we need this so that successive plotting commands don't overwrite the previous ones % only plot error bars ...

6 months ago | 0

| accepted

Answered

How do I create a Markov Matrix with variables instead of numbers for probabilities?

If your goal is to manipulate P symbolically (i.e., algebraically, rather than numerically), then you'll need to use Matlab's sy...

How do I create a Markov Matrix with variables instead of numbers for probabilities?

If your goal is to manipulate P symbolically (i.e., algebraically, rather than numerically), then you'll need to use Matlab's sy...

6 months ago | 0

| accepted

Answered

Random uniform distribution of nodes within a radius

I had a previous answer here but it occurred to me afterwards that the result wouldn't actually be uniform within the disk. Here...

Random uniform distribution of nodes within a radius

I had a previous answer here but it occurred to me afterwards that the result wouldn't actually be uniform within the disk. Here...

6 months ago | 0

Answered

How to find row wise correlation coefficients and p values for two matrices?

n = 3420; R = zeros(n,1); P = zeros(n,1); for j = 1:n [R(j),P(j)]=corr(A(j,:)',B(j,:)'); end If this is just a one-...

How to find row wise correlation coefficients and p values for two matrices?

n = 3420; R = zeros(n,1); P = zeros(n,1); for j = 1:n [R(j),P(j)]=corr(A(j,:)',B(j,:)'); end If this is just a one-...

6 months ago | 1

| accepted

Answered

rounding down using floor

I'm on R2020a on Windows 10 and I also get 0.9921. Is it possible that total does not equal exactly 8.9289? For example, if tot...

rounding down using floor

I'm on R2020a on Windows 10 and I also get 0.9921. Is it possible that total does not equal exactly 8.9289? For example, if tot...

6 months ago | 0

Answered

Error encountered using 'fzero'

First of all, it looks like P is maybe supposed to be restricted to be a positive number, and when it's not, your function retur...

Error encountered using 'fzero'

First of all, it looks like P is maybe supposed to be restricted to be a positive number, and when it's not, your function retur...

6 months ago | 1

| accepted

Answered

Mark smallest bar in 3-D bar plot

My default built-in function for drawing arrows in plots is annotation but I believe that only works in 2-D. As a work-around fo...

Mark smallest bar in 3-D bar plot

My default built-in function for drawing arrows in plots is annotation but I believe that only works in 2-D. As a work-around fo...

6 months ago | 0

Answered

How do I maintain my array size (or dimensions) when I run it through a nested for loop?

You have 3-D arrays but are only using 2-D indexing (e.g., data(:, shift+1:end) only has two indices, even though data is a 3-D ...

How do I maintain my array size (or dimensions) when I run it through a nested for loop?

You have 3-D arrays but are only using 2-D indexing (e.g., data(:, shift+1:end) only has two indices, even though data is a 3-D ...

6 months ago | 0

| accepted

Answered

Calculating standard deviation of matrix

I'm not sure I quite understand what you want, but a couple of things I see. First, row is a scalar giving the number of rows in...

Calculating standard deviation of matrix

I'm not sure I quite understand what you want, but a couple of things I see. First, row is a scalar giving the number of rows in...

6 months ago | 1

| accepted

Answered

Simulating a Continuous time markov chain

See here: https://www.mathworks.com/matlabcentral/answers/57961-simulating-a-markov-chain Also, if you have the econometrics t...

Simulating a Continuous time markov chain

See here: https://www.mathworks.com/matlabcentral/answers/57961-simulating-a-markov-chain Also, if you have the econometrics t...

6 months ago | 1

| accepted

Answered

How to compute for the distance between two tensors using matlab?

It depends on how you define "distance". There are many different ways you could do that in principle. One way would be to use t...

How to compute for the distance between two tensors using matlab?

It depends on how you define "distance". There are many different ways you could do that in principle. One way would be to use t...

6 months ago | 0

| accepted

Answered

Saving All Results Of Objective Function in Genetic Algorithm

I'm not sure it's possible to do exactly what you've indicated, but I think you should be able to get something along those line...

Saving All Results Of Objective Function in Genetic Algorithm

I'm not sure it's possible to do exactly what you've indicated, but I think you should be able to get something along those line...

6 months ago | 0

| accepted

Answered

line is filling two pixels with linewidth of 1 specified

Line widths are specified in points (1/72"), not pixels, and locations on a plot are expressed in the same units as the axes. Wh...

line is filling two pixels with linewidth of 1 specified

Line widths are specified in points (1/72"), not pixels, and locations on a plot are expressed in the same units as the axes. Wh...

6 months ago | 0

Answered

How do I plot a timeseries graph using this data?

By "creating a vector of y involving the four variables", I'm guessing you actually mean creating a matrix, i.e., by trying to p...

How do I plot a timeseries graph using this data?

By "creating a vector of y involving the four variables", I'm guessing you actually mean creating a matrix, i.e., by trying to p...

7 months ago | 0

Answered

Particle swarm optimization solving an equation system

As far as I know, you cannot directly optimize using complex variables as your optimizing variables, and of course your objectiv...

Particle swarm optimization solving an equation system

As far as I know, you cannot directly optimize using complex variables as your optimizing variables, and of course your objectiv...

7 months ago | 2

| accepted

Answered

How to exclude range of values in fmincon

One option would be to do a variable transformation in your objective function. So for example, instead of making x your optimiz...

How to exclude range of values in fmincon

One option would be to do a variable transformation in your objective function. So for example, instead of making x your optimiz...

7 months ago | 1

Answered

When does loop end?

Unless you have a continue statement somewhere (which you don't), everything enclosed between the initial for statement and the ...

When does loop end?

Unless you have a continue statement somewhere (which you don't), everything enclosed between the initial for statement and the ...

7 months ago | 0

| accepted

Answered

Write ".m" matlab code files to excel

A few things. First of all, I want to double-check that the file you're talking about is indeed an .m file. .m files are MATLAB ...

Write ".m" matlab code files to excel

A few things. First of all, I want to double-check that the file you're talking about is indeed an .m file. .m files are MATLAB ...

7 months ago | 0

| accepted

Answered

Correlation computation using a window of 3

I don't entirely understand what you're trying to do, but you may want to use corr(a,b) instead of corrcoef(a,b) or corrcoef(C)....

Correlation computation using a window of 3

I don't entirely understand what you're trying to do, but you may want to use corr(a,b) instead of corrcoef(a,b) or corrcoef(C)....

7 months ago | 0

| accepted

Answered

Matrix multiplication optimization for MUSIC DOA

Since your variable A_all is 3x55000x128, this would seem to suggest that, for iteration dir and frequency j, you want to set P_...

Matrix multiplication optimization for MUSIC DOA

Since your variable A_all is 3x55000x128, this would seem to suggest that, for iteration dir and frequency j, you want to set P_...

7 months ago | 1

| accepted

Answered

I have to solve the following

Doing this with anonymous functions is not the way to go (not to mention, your last two functions, dc2D_dt and dcD_dt, have t as...

I have to solve the following

Doing this with anonymous functions is not the way to go (not to mention, your last two functions, dc2D_dt and dcD_dt, have t as...

7 months ago | 0

Answered

How can I join two parts of a char into just one?

I see a few things. First of all, it seems the reason for the error is that you're trying to assign something to the character a...

How can I join two parts of a char into just one?

I see a few things. First of all, it seems the reason for the error is that you're trying to assign something to the character a...

7 months ago | 0

Answered

Solve large linear systems with Parallel computing toolbox

First of all, when I run the code you posted, Matlab gives warnings that A-theta(i)*I is singular to working precision for i=2,4...

Solve large linear systems with Parallel computing toolbox

First of all, when I run the code you posted, Matlab gives warnings that A-theta(i)*I is singular to working precision for i=2,4...

8 months ago | 0

Answered

How to merge two cell arrays?

Couldn't you just do it in a loop? DataMerge = cell(4,1); for j = 1:4 DataMerge{j} = [Data{j,1},Data{j,2}] end Actually...

How to merge two cell arrays?

Couldn't you just do it in a loop? DataMerge = cell(4,1); for j = 1:4 DataMerge{j} = [Data{j,1},Data{j,2}] end Actually...

8 months ago | 0

| accepted

Answered

How to vectorize nested for loops that compute pair wise correlations using indexed vectors?

There might be a better way, but here's how I might go about it. function idx_pairs = get_indices_pair_corr(data, idx, idx2, ta...

How to vectorize nested for loops that compute pair wise correlations using indexed vectors?

There might be a better way, but here's how I might go about it. function idx_pairs = get_indices_pair_corr(data, idx, idx2, ta...

9 months ago | 0