Solved

Is my wife right? Now with even more wrong husband

Again, as in "Is my wife right?" ( <http://www.mathworks.com/matlabcentral/cody/problems/149-is-my-wife-right> ), answer 'yes' r...

4 months ago

Solved

Back to basics 9 - Indexed References

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix and row and column, output the index of th...

4 months ago

Solved

Times 2 - START HERE

Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

4 months ago

Question

Record best solution in each GA generation running with UseParallel=true

Hello, Is there a way to record the best solution at each generation running with parallelization? (that is, with UseParallel=1...

5 months ago | 1 answer | 1

Question

How can one pass arguments to a custom CrossoverFunction in ga?

Hello, I am implementing a custom crossover function following the documentation. I need to pass 2 additional variables along ...

7 months ago | 1 answer | 0

Question

Is it bad practice to have nonlinear constraints array change size depending on the input solution in a genetic algorithm?

In a nonlinear ga, the nonlin constraint function is evaluated with each solution, and the output is [c,ceq]. These arrays conta...

8 months ago | 1 answer | 0

Question

Is slicing one big matrix more efficient than storing smaller matrices in a struct?

An example of the former would be: % allcases = % % +---------+------------+------------+------------+-----+-------------+ ...

8 months ago | 1 answer | 0

Question

Efficient way/best practice to slice array under a logical condition as well as other conditions

I did not know how to properly title this question, so please bear with me. Simply put, with the following two arrays: A = [0 ...

8 months ago | 1 answer | 0

Question

How do MATLAB workers/PC cores divide the work in a parallelized optimization inside a parfor loop?

For example: parfor i = 1:20 options = optimoptions('ga','UseParallel',true,'UseVectorized',false); x = gamultiobj(Ob...

10 months ago | 1 answer | 0

Question

Polar plot points appear on wrong position

Hello, I am plotting values in an array of three parameters (angle, radius, and third parameter which is colored) points with a...

10 months ago | 1 answer | 1

Question

How can I show radial ticks and axis on top of a polar plot?

Although not a MWE, this is what the code looks like: figure; polaraxes; hold on; polarscatter(vara,varb,[],varc,'.'); c =...

11 months ago | 1 answer | 0

Answered

How to put a title on a colorbar?

Alternatively, hcb=colorbar; hcb.Title.String = "A Title"; Among the properties of "hcb" there is "Title", which is a Text da...

How to put a title on a colorbar?

Alternatively, hcb=colorbar; hcb.Title.String = "A Title"; Among the properties of "hcb" there is "Title", which is a Text da...

11 months ago | 0

Question

Understanding why GA's penalty profile is so similar for any run

I am running a genetic algorithm with only nonlinear inequality constraints. The solutions is an array of "nvars" integers that ...

11 months ago | 1 answer | 0

Question

"Failure in initial user-supplied nonlinear constraint function evaluation" in a ga() with integer variables and non-linear inequality constraints

(Edit: Please read answers/comments before pointing out code mistakes.) I am trying to run a GA where the solutions are an arra...

12 months ago | 1 answer | 0

Question

How to show a seconds plot axis ticks as hh:mm

[Edited to clarify that X is a 2x2, part of a meshgrid.] Assume the data for the x-axis is duration in seconds, in both directi...

1 year ago | 1 answer | 0

Question

Extra independent component in ode integration affects other components

I am trying to understand how the ode functions in MATLAB work. In this case, I am running an ode45 or ode113 with a state that...

1 year ago | 1 answer | 0

Question

Order of elements inside sqrt/exponentiation changes ode output

I am running a code that runs an ode in which the equations of motion are exactly the same for both cases (except the line where...

1 year ago | 1 answer | 0

Question

Ways to shade points-delimited area or smooth the edge

Hi, I have a plot created from a bunch of points, that looks like this: The code looks like this: for k = 1:size(Points,1) ...

1 year ago | 1 answer | 0