Please help me with the optimization
Show older comments
Hello Dear Experts,
I wanted to ask how can I optimize the following solution:
% Step 1: f(x) = (15/8)*(1-x^2)^2 ; 0 < x < 1.
% Step 2: F(x) = 1.875*x - 1.25*x^3 + 0.375*x^5
% Step 3: Let u ~ U[0,1] => X = F^(-1)(u) => u = F(x)
% => u = 1.875*x - 1.25*x^3 + 0.375*x^5
% Step 4: Find the x that satisfy the equation.
n = 100000;
u = rand(n,1);
y = zeros(n,1);
for i = 1:n
y(i,1) = fzero(@(x) 0.375*x^5 - 1.25*x^3 + 1.875*x - u(i,1),0.5);
end
I = find(y > 0 & y < 1);
hist(y(I),1000);
It runs like 5-10 minutes.
Accepted Answer
More Answers (0)
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!