Answered
GA Multiobjective, Consider reducing the number of outputs
format long g filename = 'Returns.xlsx'; data = readmatrix(filename); nAssets = size(data, 2); %Returns and covariance...

5 years ago | 0

| accepted

Answered
How to make a rectangular shape with inner boundary having the value of 1 and outer boundary a value of 0?
For example, A=zeros(100); A(30:70,30:70)=1; A=max(0, 1-bwdist(A)/10); A( abs( conv2(A,ones(3)/9,'same')-1)<=1e-6)=0; ...

5 years ago | 0

| accepted

Answered
Remove values from column that are close in value to each other
One possibility: x=[43 90 91 128 191 192]; [~,~,G]=uniquetol(x,10,'DataScale',1); splitapply(@max,x,G)

5 years ago | 0

| accepted

Answered
Merge columns in a singular table
You can't get a numeric result with 2001 digitis of precision, but you can make a string: T=randi(10,5,3) T2=num2cell(string...

5 years ago | 0

Answered
Finding position of a multidimensional array given manual value
Your question is a little unclear to me, but I think you mean this: [yAxInd,yCxInd,yVxInd] = ind2sub(size(sh),find(sh==value))

5 years ago | 0

| accepted

Answered
Changing a word in chart title in loop
for i=1:58 title("Global change in"+yourCell{i}) end

5 years ago | 0

| accepted

Answered
Array indices must be positive integers or logical values.
You must examine the contents of floor(T.t(3)). It is zero, which is not a valid index.

5 years ago | 0

Answered
How do I make this ellipse?
fimplicit(@(x,y)16*x.^2 + 4*y.^2 -1); axis equal

5 years ago | 1

Answered
Run Nested FOR-loop Parallelly for Multivariable Function Optimization
I don't think a loop over all 9 variables is going to be practical (10^15 combinations). An important observation, though, is ...

5 years ago | 1

| accepted

Answered
Using third party toolboxes on Matlab Online
I believe Matlab online can access 3rd party code from your Matlab Drive. You can organize that content into folders, which you ...

5 years ago | 0

Answered
How can I plot each iteration of optimization function variables while retaining a fixed quantity of prior iterations on the same plot?
I'm guessing it might be necessary to store x for the k iterations, and then only plot them together, wait until the next k iter...

5 years ago | 0

| accepted

Answered
Run Nested FOR-loop Parallelly for Multivariable Function Optimization
Xgrid ={ -0.02:0.001:0.02; 20:100; 20:100; 20:100; 20:100; -15:15; -15:15; -15:15; -15:1...

5 years ago | 1

Answered
3D image alignment in a stack
N=size(tiff_stack2,3); [opt,metric]=imregconfig('monomodal'); for i=1:N tiff_stack3{i}=imregister(tiff_stack2(:,:,i),t...

5 years ago | 0

| accepted

Answered
Linprog gives a solution but one constraint is not satisfied (no notification)
load data defaultOptions=optimoptions('linprog'); [x3,fval,exitflag,output] = linprog(f3,constraints3,b3,eq',400,lb3,[], d...

5 years ago | 0

Answered
How to calculate the volume of a 3D plot defined by a matrix
It looks fine, though I would do it this way: volume=reshape( sum(h_real,[1,2]), 1,[])*(scale^2)*(1e6); plot...

5 years ago | 0

| accepted

Answered
Optimizing a fmincon function by vectorising loops?
Is vectorising the right approach to speeding up the function? If yes, why doesn't it work like this? Yes, assuming you also v...

5 years ago | 0

Answered
"contains" with multiple conditions
A = "159 ( 51,1%) 13 (4,2% ) 139 (44,7%)"; A = textscan(A,'%s','Delimiter',' ')'; A=vertcat(A{:}); A( contains(A,{'(',')','...

5 years ago | 1

Answered
"contains" with multiple conditions
A = "159 ( 51,1%) 13 (4,2% ) 139 (44,7%)"; A=eraseBetween(A,"(", ")") cellstr( extract(A,digitsPattern) )

5 years ago | 0

| accepted

Answered
How can I change opts.StartPoint for every loop iteration for the predefined points used by the curve fitting tool?
However, the user's initial points matrix would have to be defined manually, and I am looking for the same points that the tool ...

5 years ago | 0

| accepted

Answered
Identify the individual sides (or boundary) of the binary image.
I=(1:size(bw,1))'; [~,Jred]=max(bw,[],2); [~,Jyellow]=max( cumsum(bw,2),[],2); imshow(bw);hold on k=Jred>1; plot(Jr...

5 years ago | 0

| accepted

Answered
Understanding how to call function inside a classdef module
Neither one is preferable to the other as long as you haven't overloaded dot indexing for something else. As of 2021b, it is pos...

5 years ago | 1

| accepted

Answered
why Fmincon code result are infeasible
There can't be any gaurantee that fmincon will be able to find a solution (for example, one may not exist), but fmincon is aware...

5 years ago | 0

| accepted

Answered
Finding points of intersection between Curve and sides of a square
If you make the appropriate change of coordinates, your ellipses will become circles and your square will become a more general ...

5 years ago | 0

Answered
Why is it that if I adjust a curve with the curve fitting tool, it does not give me the same results as if I fit it without the tool?
In the first case, fit() doesn't know anything about the structure of your curve model. The details are hidden inside myfunction...

5 years ago | 0

| accepted

Answered
How can I compute the mean and variance of a channel using blockproc?
It will be more efficient if you download sepblockfun() instead, https://www.mathworks.com/matlabcentral/fileexchange/48089-sep...

5 years ago | 0

Answered
Interpolation doesn't reproduce the character of original curve
Perhaps I misunderstood how this works. I expected v to be scaled (compressed as it were in this case) and be reproduced over th...

5 years ago | 0

| accepted

Answered
Interpolation doesn't reproduce the character of original curve
I don't know how you are plotting, but it should look like this: plot(x,v,xq,vq,'x--')

5 years ago | 0

Answered
Sample evenly-ish vector of unevenly distributed indices
Perhaps as follows, vnew = union( min(v):delta:max(v) ,v);

5 years ago | 0

| accepted

Answered
Fill area of 2dcircle with cross line
This FEX submission looks applicable: https://www.mathworks.com/matlabcentral/fileexchange/18826-hatch-fill-patterns-plus-plus?...

5 years ago | 0

| accepted

Answered
How can I find where to split a piecewise regression and find the parameters involved in the function?
Neither of your models look right. It looks, at minimum, that you need a additional translation parameters: a_i*(x-t_i)^(c_i-1...

5 years ago | 0

Load more