clear; close all; x = -2:0.001:2; f1 = @(x) exp(-x)+1.4*exp(-x.^2); f2 = @(x) exp(x)+1.4*exp(-x.^2); figure(1); hold on; % plot(f1(x),f2(x),'o'); x1 = 0:0.01:7; y1 = interp1(f2(x),f1(x),x1,'spline'); plot(x1,y1,'-','DisplayName','Pareto Front'); xlim([0,7]); ylim([0,7]); f1i = 0; f2i = 0; f1a = 4; f2a = 2; w1 = 1/(f1a-f1i); w2 = 1/(f2a-f2i); C = max(w1*(f1(x)-f1a),w2*(f2(x)-f2a)); xopt = x(find(C==min(C))) f1opt = f1(xopt) f2opt = f2(xopt) syms f1_symbol(t) f2_symbol(t) f1_symbol(t) = @(t) exp(-t)+1.4*exp(-t.^2); f2_symbol(t) = @(t) exp(t)+1.4*exp(-t.^2); df1 = diff(f1_symbol); df2 = diff(f2_symbol); t12 = -df2/df1; t12_val = eval(subs(t12,'t',xopt)); t21_val = 1/t12_val; T = [-1 t12_val; t21_val -1] C = (t12-0.5)^2; figure(2); plot(x,subs(C,t,x),'-'); title('D=(t_{1,2}-0.5)^2'); ylim([0 0.2]); xA1 = fminsearch(C,-1.5) xA2 = fminsearch(C,0) xA3 = fminsearch(C,1) f1_A1 = f1(xA1) f2_A1 = f2(xA1) f1_A2 = f1(xA2) f2_A2 = f2(xA2) f1_A3 = f1(xA3) f2_A3 = f2(xA3) figure(1); plot(f1_A1,f2_A1,'o','DisplayName',sprintf('x=%.3g (t_{1,2}=0.5)',xA1)); plot(f1_A2,f2_A2,'o','DisplayName',sprintf('x=%.3g (t_{1,2}=0.5)',xA2)); plot(f1_A3,f2_A3,'o','DisplayName',sprintf('x=%.3g (t_{1,2}=0.5)',xA3)); legend(); t12_val = eval(subs(t12,'t',xA1)); t21_val = 1/t12_val; T1 = [-1 t12_val; t21_val -1] t12_val = eval(subs(t12,'t',xA2)); t21_val = 1/t12_val; T2 = [-1 t12_val; t21_val -1] t12_val = eval(subs(t12,'t',xA3)); t21_val = 1/t12_val; T3 = [-1 t12_val; t21_val -1] big;