Need help regarding optimization
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hi, here's the operation I want to do
1. the following operations:
A=rand(10,2)*100;
B=rand(10,2)*100;
c=[ones(10,1)*80.5 ones(10,1)*89.27];
result=A-B;
result(~(A-c>=0)) = 0
2. the following optimization (wich i don't know how to do exept with a looop but I want something faster and more straight forward)
I want to do the sum of the variable"results" and get the maximum.In this case the result would be in the form of: 1x2
So clearly I want to find the "c" that maximise "result2":
result2=sum(result)
(in the previous example the "c" were 80.5 and 89.27
So the point is when we do
result=A-B;
result(~(A-c>=0)) = 0
Some "A-B" yield a negative results so I want to find the c that
optimize positively. Let's set the "c" as c1 and c2
the final optization is going to be in the following dimesnion:
c=[ones(4,1)*c1 ones(4,1)*c2];
Thank you in advance
Gimpy
7 Comments
Gimpy
on 15 Aug 2012
Gimpy
on 15 Aug 2012
Please take the time to give just one good example that captures all of the salient features of your real problem. If you have 22000-by-18, make a specific example with 5(or 6,7 or 8)-by-3. Show exactly (give the numeric arrays) the inputs and the exact expected output(s) for your specific example.
Thanks.
Gimpy
on 15 Aug 2012
Edited: Walter Roberson
on 15 Aug 2012
Matt Fig
on 15 Aug 2012
Where did the values of 37.1 and 50 come from?
Inputs --- A=[45;37;32;50], B=[17;100;200;10]
Outputs --- C = [37.01 50]
Is this correct? If so, please show the MATLAB for loop you say you have that gets this result.
Gimpy
on 15 Aug 2012
Answers (0)
This question is closed.
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!