Question

How to extend array?

I want to extend an array like this: A = [1 2 3 4]; B = [2 3 5 7]; C =[1 1 2 2 2 3 3 3 3 3 4 4 4 4 4 4 4]; How could I do ...

ongeveer 2 maanden ago | 1 answer | 0

Question

How to add x-axis in the bottom or in the top of a figure?

I have a graph were I want to have both an x-axis for time and another showing distance. Is there some easy way to do this? I ...

ongeveer 2 maanden ago | 1 answer | 0

Answered

How to extend/add elements to an array?

I got the solution for B= [3 2 3 5]. Thanks Andrei! A=[2 3 4 5 0 1 4 5 5 0 3 4 0 2 0 ]; B=[3 2 3 5]; jj = find(A == 0); out ...

How to extend/add elements to an array?

I got the solution for B= [3 2 3 5]. Thanks Andrei! A=[2 3 4 5 0 1 4 5 5 0 3 4 0 2 0 ]; B=[3 2 3 5]; jj = find(A == 0); out ...

2 maanden ago | 0

Question

How to extend/add elements to an array?

I want to extend an array at the points were the array are 0. For example an array like this: A=[2 3 4 5 0 1 4 5 5 0 3 4 0 2 ...

2 maanden ago | 2 answers | 0

Question

How to sum spesific numbers in an array?

Array like this: A=[1 2 1 1 0 2 2 0 0 2 1 0 2 1 1 0 0]; How to sum every number between each zero occurence like this: B=[5 0...

2 maanden ago | 1 answer | 0

Question

How to make some optimization variables equal to each other?

I want that some spesific variables that are to be optimized, are to be equal to each other. lets say that i want this: x(1)=x(...

2 maanden ago | 1 answer | 0

Question

How to make a new array based on two arrays?

A=[1 4 3 1 5 9 1 11 14 15 16]; B=[1 4 3 1 5 6 7 8 9 1 11 12 13 14 15 16]; How to make a new array like this: C=[1 4 3 1 5 nan...

2 maanden ago | 1 answer | 0

Question

Remove some numbers from an array and replace them with zero?

Lets say the array is like this: A = [4 4 4 4 6 6 6 6 6 6 2 2 3 3 3 5 5 5 5 5 3 3 3]; How could I change the matrix to be like...

2 maanden ago | 1 answer | 0

Question

how to solve many polynomial equations listed in a matrix?

I have a matrix where each row is a polynomial equation: A=[0.01 620.085 -3750 0.01 620.082 -3750 0.01 620.079 -3...

3 maanden ago | 2 answers | 0

Question

Is it possible to constrain the unknown x in an optimization problem to be rounded up to 1 when it originally is a value between 0 and 1?

I use the fmincon function and have set the lower bound to be 0 and upper bound to be 1. I want the values that are optimized to...

3 maanden ago | 1 answer | 0

Question

Is it possible to detect and replace abnormal/wrong numbers in an array?

I have a dataset which is an array containing values, and which are plotted in the figure below. A section of the array for the ...

3 maanden ago | 2 answers | 0

Question

How to group an array and then replace each group with different numbers?

Example of array: A = [1 1 1 0 0 0 1 0 0 1 0 1 1 0 0 ]; Wanted array: B = [1 1 1 4 4 4 1 5 5 1 6 1 1 3 3]; Is is possible to s...

3 maanden ago | 2 answers | 0

Question

How to automatically constrain some of the unknown values in an optimization problem?

I have an optimization problem with several unknown values (x) which is a part of an array: A=[0 0 x(1) x(2) 0 0 0 x(3) x(4) x(...

3 maanden ago | 2 answers | 0

Question

How to replace some values in an array with zero and some with values from another array?

A = [2 4 0 0 5 3 0 2 1 0 2]; B = [1 1 0 1]; I want to replace numbers in A greater than 0 with 0, and numbers in A which is 0 ...

3 maanden ago | 2 answers | 0