Please help me with the optimization
古いコメントを表示
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.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Problem-Based Optimization Setup についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!