Answered

How to put a variable equal to a vector in an if cycle

My guess % your data TIMEFAILURECOG= [2 4 10 50]; Matrixdiff=[0,TIMEFAILURECOG]; DIFFERENCE=diff(Matrixdiff); INDEXCOG1=fin...

How to put a variable equal to a vector in an if cycle

My guess % your data TIMEFAILURECOG= [2 4 10 50]; Matrixdiff=[0,TIMEFAILURECOG]; DIFFERENCE=diff(Matrixdiff); INDEXCOG1=fin...

alrededor de 14 horas ago | 0

| accepted

Answered

Invalid indexing when simplifying a symbolic expression

C is used as a function C(k3r+k4f)

Invalid indexing when simplifying a symbolic expression

C is used as a function C(k3r+k4f)

4 días ago | 0

Answered

Could anyone help me to solve the issue.

For your case NN = mat2cell(A,[1 1 1],2) A bit more general NN = mat2cell(A,ones(size(A,1),1),size(A,2))

Could anyone help me to solve the issue.

For your case NN = mat2cell(A,[1 1 1],2) A bit more general NN = mat2cell(A,ones(size(A,1),1),size(A,2))

4 días ago | 0

Answered

how to plot a fitness or objective function with optimum values

objFun = @(x)100.*(x(:,1).^2 - x(:,2)).^2 + (1 - x(:,1)).^2; conFun = @(x)[x(:,1).*x(:,2)+x(:,1)-x(:,2)+1.5, 10-x(:,1).*x(:,2...

how to plot a fitness or objective function with optimum values

objFun = @(x)100.*(x(:,1).^2 - x(:,2)).^2 + (1 - x(:,1)).^2; conFun = @(x)[x(:,1).*x(:,2)+x(:,1)-x(:,2)+1.5, 10-x(:,1).*x(:,2...

6 días ago | 0

Answered

Multi-objective optimisation using results from external simulation

Look at this video https://www.youtube.com/watch?v=Lgjf0vWl7Ik it seems the author is doing a similar data exchange between Di...

Multi-objective optimisation using results from external simulation

Look at this video https://www.youtube.com/watch?v=Lgjf0vWl7Ik it seems the author is doing a similar data exchange between Di...

6 días ago | 0

Answered

Recall elements inside the rows of a matrix based on a predefined array

A = M(V,:);

Recall elements inside the rows of a matrix based on a predefined array

A = M(V,:);

6 días ago | 0

| accepted

Answered

how to draw a 3d surface of exp(x+iy)

Suppose that you want to plot the magnitude of the exp(z) % setup the range of your plot in x and y (-2,2) and the resolution (...

how to draw a 3d surface of exp(x+iy)

Suppose that you want to plot the magnitude of the exp(z) % setup the range of your plot in x and y (-2,2) and the resolution (...

7 días ago | 1

Answered

could anyone help me how to display the position of all the numbers present in matrix.

[iRow, jCol, value] = find(A); then you can put them in a matrix, if you like position = [value, iRow, jCol];

could anyone help me how to display the position of all the numbers present in matrix.

[iRow, jCol, value] = find(A); then you can put them in a matrix, if you like position = [value, iRow, jCol];

7 días ago | 1

Answered

could anyone help me to calculate the euclidean distance for the matrix.

I have found that this is usually the fastest way, since the square of the binomial is unrolled D = sqrt(abs(bsxfun(@plus,sum(A...

could anyone help me to calculate the euclidean distance for the matrix.

I have found that this is usually the fastest way, since the square of the binomial is unrolled D = sqrt(abs(bsxfun(@plus,sum(A...

7 días ago | 0

Answered

Take values from an matrix automatically.

Prog_old = Prog; % modify Prog as desired Prog = Prog*2; % dummy operation % reload the old version Prog = Prog_old;

Take values from an matrix automatically.

Prog_old = Prog; % modify Prog as desired Prog = Prog*2; % dummy operation % reload the old version Prog = Prog_old;

7 días ago | 0

Answered

picking up data file in each iteration

Following Stephen link numFiles = 200; for k = 1:numfiles fileName = sprintf('s%d.mat', 1008+10*k); data = load(fileNa...

picking up data file in each iteration

Following Stephen link numFiles = 200; for k = 1:numfiles fileName = sprintf('s%d.mat', 1008+10*k); data = load(fileNa...

7 días ago | 1

Answered

Filling gaps in time series with Nan

For the particular case % preliminary setup newData = [1:10; NaN(1,10)]'; % fill-in newData(data(:,1),2) = data(:,2) To m...

Filling gaps in time series with Nan

For the particular case % preliminary setup newData = [1:10; NaN(1,10)]'; % fill-in newData(data(:,1),2) = data(:,2) To m...

8 días ago | 0

Answered

Removing char in a mixed string column so only numerical values are left?

Check erease erease(yourString,'LED');

Removing char in a mixed string column so only numerical values are left?

Check erease erease(yourString,'LED');

8 días ago | 1

Answered

Separating of succecive monotonic vectors

Let's assume your data are stored in x and y vectors. I take them from your picture % get the data from picture fig = gcf; ax...

Separating of succecive monotonic vectors

Let's assume your data are stored in x and y vectors. I take them from your picture % get the data from picture fig = gcf; ax...

8 días ago | 0

| accepted

Answered

How to stop annoyed messages in command window?

I have a similar problem with Mac because I installed a package to manage split screen, named BetterSnapTool. For Linux, see if...

How to stop annoyed messages in command window?

I have a similar problem with Mac because I installed a package to manage split screen, named BetterSnapTool. For Linux, see if...

8 días ago | 0

| accepted

Answered

Make a program to convert a number to decimal, octal, hexadecimal and binary value

You can use the functions bin2dec dec2bin hex2dec dec2dex and the more general dec2base base2dec

Make a program to convert a number to decimal, octal, hexadecimal and binary value

You can use the functions bin2dec dec2bin hex2dec dec2dex and the more general dec2base base2dec

8 días ago | 0

| accepted

Answered

How to assign a different name of a matrix for each iteration?

Don't use this sintax (for details, see https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not...

How to assign a different name of a matrix for each iteration?

Don't use this sintax (for details, see https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not...

8 días ago | 2

| accepted

Answered

remove specific rows by referencing on the first digit of each row.

index = 1; % A(:,1) == index finds the rows with specific value (logical indexing) B = A(A(:,1) == index,:)

remove specific rows by referencing on the first digit of each row.

index = 1; % A(:,1) == index finds the rows with specific value (logical indexing) B = A(A(:,1) == index,:)

9 días ago | 0

Answered

delete and insert entries in a vector

If A is a matrix, I assume you have column vectors, if not, please provide A % your (column) vector c = [1 1 3 4 5 6 7 8 11 10...

delete and insert entries in a vector

If A is a matrix, I assume you have column vectors, if not, please provide A % your (column) vector c = [1 1 3 4 5 6 7 8 11 10...

9 días ago | 0

| accepted

Answered

combining different size arrays based on time dimension and compute average for the last column

find rows in M2 that are present in M1 (assuming that all rows in M2 are present in M1 [~,iRows] = ismember(M2(:,1:4),M1(:,1:4)...

combining different size arrays based on time dimension and compute average for the last column

find rows in M2 that are present in M1 (assuming that all rows in M2 are present in M1 [~,iRows] = ismember(M2(:,1:4),M1(:,1:4)...

9 días ago | 0

| accepted

Answered

Sort of peak analysis

If the signal is not too noisy you can work with ‘diff’ and look for the change of sign

Sort of peak analysis

If the signal is not too noisy you can work with ‘diff’ and look for the change of sign

10 días ago | 1

Answered

How to improve the accuracy of lu decomposition?

It's a weird way to check the accuracy. What about checking the norm of the residual % data N = 5; A = rand(N)+eye(N)+1j*rand(...

How to improve the accuracy of lu decomposition?

It's a weird way to check the accuracy. What about checking the norm of the residual % data N = 5; A = rand(N)+eye(N)+1j*rand(...

11 días ago | 0

Answered

How to write a matlab function to find largest jump between consecutive vectors without using max or min

Try xd = abs(diff(x)) [K,y] = max(xd)

How to write a matlab function to find largest jump between consecutive vectors without using max or min

Try xd = abs(diff(x)) [K,y] = max(xd)

11 días ago | 0

Answered

matrix multiplication for "3-D" matrices

Let's start saying that the data structure you are using is not the best one. See https://www.mathworks.com/matlabcentral/answer...

matrix multiplication for "3-D" matrices

Let's start saying that the data structure you are using is not the best one. See https://www.mathworks.com/matlabcentral/answer...

11 días ago | 0

Answered

MATLAB doesn't let me plot 3 graphs in the same plot

As Guillame pointed out, you just have to plot them (without the indexing): h = figure; hold on, grid on plot(t,v); plot(t...

MATLAB doesn't let me plot 3 graphs in the same plot

As Guillame pointed out, you just have to plot them (without the indexing): h = figure; hold on, grid on plot(t,v); plot(t...

12 días ago | 0

Answered

MATLAB doesn't let me plot 3 graphs in the same plot

The problem is here plot(tm,ve(i+1),'green') ... plot(tn,vi(i+1)) ve(i+1) is a number, as well as vi(i+1), while tm and tn a...

MATLAB doesn't let me plot 3 graphs in the same plot

The problem is here plot(tm,ve(i+1),'green') ... plot(tn,vi(i+1)) ve(i+1) is a number, as well as vi(i+1), while tm and tn a...

12 días ago | 0

Answered

Best way to calculate the determinants of a series of matrices?

Not sure if it you can speedup your code, but a single line code to do the job is Delta = arrayfun(@(i)det(squeeze(G(i,:,:))),1...

Best way to calculate the determinants of a series of matrices?

Not sure if it you can speedup your code, but a single line code to do the job is Delta = arrayfun(@(i)det(squeeze(G(i,:,:))),1...

12 días ago | 0

Answered

Compute execution time without printing statement?

You can just save the value in a variable timerValue = tic; % something very useful to do tstop = toc(timerValue);

Compute execution time without printing statement?

You can just save the value in a variable timerValue = tic; % something very useful to do tstop = toc(timerValue);

13 días ago | 0

Answered

Extract data in a single vector after a FOR cycle

Ciao, You can try to reshape your data, then apply max on the columns media_reshape = reshape(media,85,113); max_media = max(...

Extract data in a single vector after a FOR cycle

Ciao, You can try to reshape your data, then apply max on the columns media_reshape = reshape(media,85,113); max_media = max(...

13 días ago | 0

| accepted

Answered

Comparing Duration Arrays is time consuming - How to improve my script?

Not sure if I understand correctly the problem without data. I try: idx = find(clock > tdur(1),1,'first')

Comparing Duration Arrays is time consuming - How to improve my script?

Not sure if I understand correctly the problem without data. I try: idx = find(clock > tdur(1),1,'first')

13 días ago | 0

| accepted