Community Profile

# Matt J

##### Last seen: Today
6,389 total contributions since 2009

Professional Interests: medical image processing, optimization algorithms

View details...

Contributions in
View by

Why do I get the following error using fmincon?
Because the are unconstrained, the only way the inner max operation can have a finite result is if [A1;A2]*x=[0;0] and therefor...

2 hours ago | 0

| accepted

Why do I get the following error using fmincon?
Could you help me to understand what is wrong? linprog() and therefore innermax() can return an empty matrix [] when it does no...

3 hours ago | 0

Question

Programmatically testing whether a variable is an optimoptions object
I was wondering if there was something like an isoptimoptions function that could be used to test in general whether a variable...

6 hours ago | 0 answers | 1

### 0

Easier method to iterative matrix multiplication?
No, a loop is the best way.

2 days ago | 0

| accepted

How to set specific variables in fmincon to be integers only?
fmincon doesn't allow integer constraints, but intlinprog and ga do. Failing, that, you could just run a loop that tests all co...

2 days ago | 3

| accepted

Trouble with spdiags and how it produces Tridiagonal matrix?
Why is this the case and how can I fix it so that it has 4 1s, whilst still having 4 1s in the -1st diagonal as well From the d...

2 days ago | 0

| accepted

Trouble with spdiags and how it produces Tridiagonal matrix?
matrix = repelem([1 2 3]',[4 , 1 ,5]); matrix2 = repelem([0.5 1.5]',[5,5] ); T=spdiags([matrix matrix2/2], -1:0, 10, 10); T...

2 days ago | 0

How do I minimize this code
A=input('Enter Matrix A: ') B=input('Enter Matrix B: ') C=input('Enter Matrix C: ') n=length(A); Con=cell(1,n); Obs=Con....

3 days ago | 0

x for y is?
[pks,idx] = findpeaks (-M2B{:,3},'MinPeakProminence',4); pks = -pks; peak_time=M2B{idx,1}; peak_displacement=M2B{idx,2};

3 days ago | 0

| accepted

Array indices must be positive integers or logicsal values
The intention of this part of the code is unclear k=0; step=1; for q=0:step:6283 k=k+1; x(k)=q; y(k)=Ey(q); en...

3 days ago | 0

Difference between Matrix and array?
Matrices can only be two-dimensional, whereas arrays can have any number of dimensions. The term "page" for the 3rd dimension do...

4 days ago | 0

| accepted

Problem related to fminbnd
You could plot the function to see how its shape varies with the parameters and to confirm whether fminbnd is giving the correct...

4 days ago | 0

| accepted

Visualizing 3 dimensional array
You could probably use volumeViewer, https://www.mathworks.com/help/images/explore-3-d-volumetric-data-with-volume-viewer-app.h...

5 days ago | 1

Calculate mean of every 4 elements in a row for an array

5 days ago | 0

Using if and of two columns to find the value in another column
Here, I use T as the name of your table, lookup=abs(T.X-78.5)<=0.5 & abs(T.Y-48.5)<=0.5; T.Value(lookup),

5 days ago | 0

| accepted

Same number of Rows and Cols of a matrix (N*N)
validateattributes(A,"numeric",{"square"})

6 days ago | 0

Constrained Global Optimization Problem with MultiStart, GA and HybridFunction using Parallel Processing whithout Step
A=input('Enter Matrix A: ') B=input('Enter Matrix B: ') C=input('Enter Matrix C: ') n=length(A); Con=cell(1,n); Obs=Co...

6 days ago | 0

How to do a matrix from vectors
One way, A=cell2mat( cellfun(@single,{time1 time2 Hs_buoy Tm_buoy Dm_buoy},'uni',0) )

6 days ago | 0

how can i split a 400*400 matrix into smaller one
You could do it as below, with the help of mat2tiles, https://www.mathworks.com/matlabcentral/fileexchange/35085-mat2tiles-div...

7 days ago | 0

Custom CUDA kernels and gpuArrays
Have a look at the documentation for CUDAKernel objects https://www.mathworks.com/help/parallel-computing/run-cuda-or-ptx-code-...

8 days ago | 1

| accepted

Redistribution of elements of various arrays into a single multidimensional one
I think the loop you've shown would work just fine, but a quicker way would be array2=repelem(reshape(array1,1,1,[]), 200,4);...

8 days ago | 1

discrte to softmax : Attempt to grow array along ambiguous dimension
I know its caused becouse target is larger then array but please help how i should change my code to make it work Did you inten...

9 days ago | 0

| accepted

Max of vector in higher dimensional array subject to constraints
N=ndims(A); %A is the given matrix z=size(A,N); idx=reshape(1:z, [ones(1,N-1),z] ) < constraint; %requires R2016b or h...

9 days ago | 1

| accepted

How to generate random integer from 1 to N except some integers in between?
No loops required, N=10; b=3; M=5; %example data list=setdiff(1:N,b); selection=list(randperm(N-1,M)) %result

9 days ago | 1

| accepted

Matrix consisting of sub-elements of another matrix
By indexing,e.g., >> x = [ 1 2 3 4 5 6 7 8 9]*10; >> y=x([1,2,4,5,9]) y = 10 20 40 50 90

9 days ago | 0

| accepted

How to create an object using class name
function newObj = createNewObject(obj) newObj = feval( class(obj) ); end

9 days ago | 0

| accepted

Adding just one line in my code slows the GPU.
Pre-allocate on the GPU. Also, pre-compute things on the GPU that are easily vectorized and don't depend on r. R=gpuArray.zeros...

9 days ago | 0

Converting a row to diagonal matrix
Did some guessing as to what you meant, but I think this is what you want: A=tril(true(16),-1); B=double(A); B(A)=rowdata; ...

9 days ago | 0

| accepted

Find minimum of a 15x100 and return in a vector of 1x100. is this possible?
The names of the variables you wrote to the table Min_AS,Med_AS,Max_AS are different from the original variable names you show...

9 days ago | 0