Answered
Calculating the averages of different groups of values
x=[3 3 3 4 4 5 5 5 5 3 11]; y=[1 2 4 5 7 1 1 8 10 10 1]; groupBounds=[0; find(diff([x(:); NaN])~=0)]; groupAverage=a...

9 years ago | 1

| accepted

Answered
Indexing polynomials using 'for' loop
%% Solution 1: (not recommended) p1 = [0 2 0 -2 6 -1]; p2 = [1 3 0 -2 0 0]; p3 = [0 0 3 1 0 -10]; p4 = [0 0 0 -4 1...

9 years ago | 1

| accepted

Answered
How to evaluate a derivative of a function at a point?
because subs replaces x with one. Doesn't evaluate. So diff( cos(x) -x ) returns -sin(x) -1 and then you replace x with one and...

9 years ago | 7

| accepted

Answered
fsolve to find circle intersections
% Center of the circles C1=[0,0]; C2=[5,0]; % Radius of the circles R1=3; R2=5; % x1(x,y) on the...

9 years ago | 0

| accepted

Answered
How to generate two subsets randomly from a matrix without repetition?
So we have matrix A with 10 elements. We want to randomly divide it into two *non-overlapping* subset, one with 4 elements anoth...

9 years ago | 2

| accepted

Answered
Can I write a Genetic algorithm code for multiple choice questions?
use MATLAB's <http://www.mathworks.com/help/gads/ga.html GA()> command. Since you have four choices, then you are pretty much i...

9 years ago | 0

| accepted

Answered
Sum of duplicate dates in an array
I would use <http://www.mathworks.com/help/stats/grpstats.html grpstat()> as follow: if you just want to sum by the group her...

9 years ago | 0

| accepted

Answered
Find the rows in matrix B that contain the two numbers in each row of matrix A, in every possible order
have you considered parallel processing? You could start MATLAB parallel workers using: parpool % if you don't it would ...

9 years ago | 2

| accepted

Answered
how can I use my function on 3*3 blocks?
inputData=zeros(10,10); inputData(randi(100,[15,1]))=1 inputData = 0 0 0 0 0 0 0 ...

9 years ago | 0

| accepted

Answered
replace number by string
Well, a quick solution would be: valueCell={ 23,23,23, ... 9997,9997,9997,9997,9997,9997,9997, ... ...

9 years ago | 0

| accepted

Answered
Choosing the best parameters for strategy with genetic algorithm
Let's say you have successfully coded strategy function which provided seven input parameters, it would give you the 'Sharpe Rat...

9 years ago | 0

| accepted

Answered
how to select data based on month
Here is what you should do: I have assumed that you store those two columns in a csv file as follow: % reading t...

9 years ago | 2

| accepted

Answered
Surface plot based on cell center values
Data=rand(10,10); imagesc(s); check <http://www.mathworks.com/help/matlab/ref/imagesc.html imagesc()> for detail des...

9 years ago | 1

| accepted

Answered
Table "Vertical Lookup", how to do it?
Look up <http://www.mathworks.com/help/matlab/ref/join.html join()> and <http://www.mathworks.com/help/matlab/ref/outerjoin.html...

9 years ago | 0

| accepted

Answered
GA in Matlab 2014???
Since you have discrete values for x1 to x5 you need to define it as an integer problem. (I know x1,x2,x3 are not integer input ...

9 years ago | 0

| accepted

Answered
merge two tables in matlab
% Creating Table1 T1=table(['A';'B';'C'],[2;5;6],[3;7;8],[4;8;6],'VariableNames',{'SampleName','P1','P2','P3'}) T1 = ...

9 years ago | 2

| accepted

Answered
Insert rows from one matrix into another
use <http://www.mathworks.com/help/matlab/ref/sortrows.html sortrows()> command as follows: A = [2373 259 18.10 23.80 0.20...

9 years ago | 0

| accepted

Answered
how to create 1*101 of some integer array?
Yo have: A = zeros(1,101); and then later you have cumtrapz(x,-4*A); all elements of *A* are zero so *-4*A* is ...

9 years ago | 0

| accepted

Answered
How to assign a particular value to each element of a structure array for a particular field?
n=3; %initilizing some test structure s=struct('f',cell(n,1)); % generate r vector r=mat2cell(rand(1,n...

9 years ago | 0

| accepted

Answered
How do I access structrure fields from input parser optional inputs
That's not how *varargin* works if you have function ptest(s1,varargin) .... end then once you call it as: ...

9 years ago | 0

| accepted

Answered
My matlab code is giving me this error "Too many outputs requested". If someone can help me solve this?
Don't know why *cloud = cloudiness{matchrow, 2};* is causing too many output request error. Are you sure the error is for that l...

9 years ago | 0

| accepted

Answered
Sum of Cells next to a String
% creating sample data data={'VLGMC', 1, 'DLG', 4, 'a', 7; ... 'VLGMC', 2, 'c', 5, 'a', 8; ... 'b',...

9 years ago | 0

| accepted

Answered
Could fsolve cause trouble when using it to solve linear equations?
Yes, you can, but if you have linear system of equations you have much better and optimized function for system of linear equati...

9 years ago | 0

| accepted

Answered
Create variable from cell array based on strings
Var1={'A',6; ... 'B',7; ... 'B',7; ... 'A',8; ... 'C',10; ... 'A',9; ... ...

9 years ago | 0

| accepted

Answered
matrix to vector matrix ?
a = [111 ,101, 100]; num2str(a,'%d') ans = 111101100

9 years ago | 1

| accepted

Answered
How to minimize a parameter in a differential equation
Here is the outline of the code for objective function objectiveFunction (Conductivity) -- Use the above code you mentio...

9 years ago | 0

| accepted

Question


possible Bug? or checking if OverFlow happened?
I have a matrix of size (6472908 x 67) all single values. Different columns have different max/min (there are different variable...

9 years ago | 3 answers | 0

3

answers

Answered
Speed up stepwise averaging
if the indeces in the index variable are like your example next to each other you can take advantage of that. Here is the timing...

9 years ago | 1

| accepted

Question


GA Ignores Initial Population and Initial Scores
I am trying to optimize a function which accepts over 1300 parameters, (all integers between 1 and 13). The output is a score wh...

9 years ago | 1 answer | 0

1

answer

Answered
Plots of Savitzky-Golay
do it like this plot(x(1:length(SG0)),y(1:length(SG0))','k','LineWidth',2.5); hold on plot(x(1:length(SG0)),SG0','r',...

10 years ago | 1

| accepted

Load more