I have been creating a minimal code located at the code-box for minimize the function, but i'm not sure working of code is correctly. Is there any wrong?
Thx.
clear all clc slo=[0.01 0.012 0.013 0.012 0.008 0]; for i=1:1:numel(slo); WR(i)=0.01*9.81*1700*cos(i); WL=@(velo) 0.5*0.25*1.2*2.65.*velo^2; WS(i)=9.81*1700*sin(i); WB=0; end WT=@(velo) sum(WR)+WL(velo)+sum(WS)+WB; fun = @(velo) WT(velo); x1 = 50/3.6; x2 = 90/3.6; options = optimset('Display','iter'); velo = (fminbnd(fun,x1,x2,options))*3.6 %km/h
Best Answer