Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Need help regarding optimization

1 visualización (últimos 30 días)
Gimpy
Gimpy el 15 de Ag. de 2012
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentarios
Gimpy
Gimpy el 15 de Ag. de 2012
Editada: Gimpy el 15 de Ag. de 2012
the value the values of 37.1 and 50 come from trial and error in Excel by testing:
=IF(A2>=C2,(A2-B2),0)= 28
=IF(A3>=C3,(A3-B3),0)=0
=IF(A4>=C4,(A4-B4),0)=0
=IF(A5>=C5,(A5-B5),0)=40
In this case it's the result we are looking for.
Gimpy
Gimpy el 15 de Ag. de 2012
Here’s my problem with more explanation again:
Matrix A,B,C :22 500 x18
Matrix c : each colum are scalar
Exemple :[50;50;50;50 72.25;72.25;72.25;72.25]
… Here’s what I want to do :
For each elements in A, lets call them ai, if ai >ci then
ai - bi
else
ai - bi =0
Here’s what I do in matlab(for simplification I do a 4x1)
a1=[88;57;42;100];
a2=[98;87;32;80];
A=[a1 a2];
b1=[78;5;32;106];
b2=[88;87;35;88];
B=[b1 b2];
c=[ones(4,1)*80.5 ones(4,1)*89.27];
result=A-B;
result(~(A-c>=0)) = 0
result2=sum(result)
****Now here’s the point : I want to find the matrix c that’s going to maximise :
result2=sum(result).
The results should be an interval
In the revious example I’am expecting MATLAB to give something like:
resultat2= 68
C_lower= 37
C_upper=45
Or at least one one of the 2 results (37 or 45).
I found this result by calculating result2=sum(result) by trial and error until
I get the maximum value(result2=68).
Please keep I mind that I want to work with 22500x18

Respuestas (0)

La pregunta está cerrada.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by