Answered
Does the initial population matrix have to satisfy constraints genetic algorithm matlab
Will MATLAB be able to automatically weed out the childs which do not satisfy the constraints? GA satisfies inequality and nonl...

4 years ago | 0

Answered
how to fix this error 'interp2'
Because your first argument to interp2 is a matrix while the second is a scalar.

4 years ago | 0

Answered
Why does complex number sign change?
Because it is equivalent to 2-1/(2i). In all likelihood, you intended to do this: a=2-(1/2)*i

4 years ago | 0

| accepted

Answered
How to specify breaks for spline fitting?
One way, xknots=... %specify the break points fun=@(y,xdata)spline(xknots,y,xdata); y0=zeros(1,numel(xknots)); y=...

4 years ago | 0

Answered
fmincon variable is start value
You didn't include everything we need to run the code (e.g., Strompreis2020.txt) however here are some guesses: (1) Your choice...

4 years ago | 0

| accepted

Answered
Optimize GPU code with nested pagemtimes
I don't think you need either a loop or a second pagemtimes call. Wr=reshape(W,16,1000); Qr=reshape(Q,16,16,2000); M=sum(pa...

4 years ago | 1

| accepted

Answered
how reduce the y axis value?
Use ylim, e.g., ylim([0.05,0.2])

4 years ago | 0

Answered
How to regularize the Levenberg-Marquardt algorithm in lsqnonlin?
You can append the square root of the regularization term to the vector . However, your objective function does not look differe...

4 years ago | 0

Answered
Calculating mean across a column and then subtracting it from all observations based on a row condition
G=findgroups(data(:,2)); Means=splitapply(@mean, data(:,6),G); data(:,6)=data(:,6)-Means(G);

4 years ago | 0

Answered
Constrained regression with constrains on the slopes
AA=log(K(:)./L(:)); bb=log(Q(:)./A(:)./L(:)); alpha=min( max(AA\bb,0) ,1 ); beta=1-alpha;

4 years ago | 0

Answered
using a for loop to find the mean of a set of data
out = mean( reshape(TSMo,7,2,6) ,2); out=out(:);

4 years ago | 0

| accepted

Answered
Trouble saving workspace variables to a file in a certain path.
save( fullfile('MyFiles/Data',filename) ,'var1','var2');

4 years ago | 0

| accepted

Answered
Is it possible to (non-linear) minimize x^y by choosing both x and y?
Why does the problem-based approach not "translate" the problem "correctly" in this case ?...I just cannot understand that the p...

4 years ago | 0

Answered
Reshaping data from a MxN matrix to three vectors that preserve M, N and mxn value
sz=size(yourMatrix); [X,Y]=meshgrid(1:sz(2),1:sz(1)); x=X(:); y=Y(:); value=reshape(yourMatrix',[],1); %3 vectors

4 years ago | 0

Answered
Open parallel pool within workers / Hierarchichal parallel runs
So, first of all, you shouldn't be calling parpool inside your fitness function. That should happen before the optimization star...

4 years ago | 0

| accepted

Answered
Is it possible to (non-linear) minimize x^y by choosing both x and y?
w = optimvar('w','Lower',log(1.01),'Upper',log(100)); %w=log(x) z= optimvar('z','Lower',sqrt(1.01),'Upper',sqrt(2)); %z=sqrt(y...

4 years ago | 0

Answered
Find out whether a 2D line (y = a*x + b) intersects with a square without using "solve" (I need something faster)
Sort of like William's, but faster for some reason: % example line parameters: a = 1.61; b = -3.1; % example square paramet...

4 years ago | 2

| accepted

Answered
Find out whether a 2D line (y = a*x + b) intersects with a square without using "solve" (I need something faster)
Using linexlines2D, https://www.mathworks.com/matlabcentral/fileexchange/93470-intersections-of-multiple-2d-lines-or-line-segme...

4 years ago | 2

Answered
How to interpolate a cloud of points?
I've no way of testing this without your row/column data, but: [rows, columns, count_there] = find(store == max(store)); [...

4 years ago | 0

| accepted

Answered
Filling specific holes in an image without changing edges
k=[1 1 1; 1 0 1; 1 1 1]; mask=conv2(YourImage,k,'same')>threshold; YourImage=regionfill(YourImage,mask);

4 years ago | 0

Answered
How to have x-axis go from 0 to 1 back to 0
You can use xticklabels() to put anything you want on the x-axis.

4 years ago | 0

| accepted

Answered
How can I save the last iteration of estimated model parameters (using an optimizer) before timing out?
Some relevant reading https://www.mathworks.com/help/matlab/math/output-functions.html https://www.mathworks.com/help/matlab/m...

4 years ago | 0

Answered
Boundary detection, somewhat like bwperim, but for a binary vector?
Download this, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-in-vecto...

4 years ago | 1

| accepted

Answered
How to apply linear least squares fit for two entities?
You can do a total least squares fit using linear2dFit() from, https://www.mathworks.com/matlabcentral/fileexchange/87584-objec...

4 years ago | 0

| accepted

Answered
Opposite coordinate in the image
Use linexlines2D, to be downloaded from, https://www.mathworks.com/matlabcentral/fileexchange/93470-intersections-of-multiple-2...

4 years ago | 0

Answered
How to code "e" by itself in equation e-1?
e=exp(+1)

4 years ago | 0

| accepted

Answered
Convert polynomial operations inputs in double vector as output
converter('2*s^2 + s +1') converter( 's*(s+1)*(s+5)' ) converter('(s+2)*(s+3)^2') function p=converter(str) fn=str2func...

4 years ago | 1

| accepted

Answered
Find value of signal A at a given value of signal B (twice for every cycle)?
Download this, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetitions-in-vecto...

4 years ago | 0

Answered
What's the best way to solve this implicit equation?
Use fzero

4 years ago | 0

Answered
Setting min and max values
data = cell2table(data); max_col567 = max(data{:,5:7},[],'all'); min_col567 = min(data{:,5:7},[],'all'); fmt=fillmissin...

4 years ago | 0

| accepted

Load more