optimization and sensitivity analysis

2 views (last 30 days)
rui xiong
rui xiong on 7 Jan 2021
Answered: Kartik Saxena on 21 Feb 2024
Hi. Here are my objectives:
  1. I want to find what are the value of "pa" and "pb" that maximize the equation: pi= (pa+pb)*na*nb, where "na" is a function of "pa", "nb" is a function of "pb".
  2. And I want to know how the optimal combination of pa,pb) changes with the parameter "ba" and "bb", and
  3. to draw a graph with "x=ba, y=bb, z =pa" as well as a graph "x=ba, y=bb, z =pb".
Could you please help me with the code? Thanks a lot.
Parameters
ba >=0 <=8
bb >=0 <=10
Variables
pa=0
pb=0
Equations
maximize (pa+pb)*na*nb
va=rand(1000,1)*ba;
vb=rand(1000,1)*bb;
na=0;
for i=1:size(va,1)
if va(i,1)>pa
na=na+1;
end
end
nb=0;
for i=1:size(vb,1)
if va(i,1)>pb
nb=nb+1;
end
end

Answers (1)

Kartik Saxena
Kartik Saxena on 21 Feb 2024
Hi,
To find the values of 'pa' and 'pb' that maximize the equation "pi = (pa + pb) * na * nb", where 'na' is a function of 'pa' and 'nb' is a function of 'pb', and to understand how the optimal combination changes with parameters 'ba' and 'bb', you can use MATLAB's Global Optimization Toolbox.
All of these objectives can be achieved by using this toolbox along with functions like 'plot' and 'surf', which would eliminate the need for redundant code as well.
Refer to the following MathWorks documentation for detailed information regarding Global Optimization Toolbox:

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!