Question: clc clear all close all x ( 1 , : ) = [ - 9 . 6 - 6 - 2 . 6 - 1

clc
clear all
close all
x(1,:)=[-9.6-6-2.6-1.10.62.32.88.310];
v(1,:)=[000000000];
f(1,:)=-x(1,:).^2+5*(x(1,:))+20;
r1=[0.210.1130.1780.241];
r2=[0.8760.7060.5070.302];
LBP(1,:)=x(1,:);
LBF(1,:)=f(1,:);
[C.I]=max(LBF(1,:));
GBF(1)=c;
GBP=LBP(1,I);
w=1;c1=1;c2=1;
for i=1:4
%update velocity
v(i+1,:)=w*v(i,:)+c1*r1(i)*(LBP(i,:)-x(i,:))+c2*r2(i)*
BY USING THE ABOVE CODE AS REFERENCE PLS PROVIDE MATLAB CODE FOR THE BELOW QUESTION
FIND THE BEST VALUE FOR x that maximizes the functions y=x^3-3x^2+4cosx-2sin^2x for -5<=x<=5
Take x1=30,x2=31,x3=32,x4=33,x5=35,x6=36,x7=37,x8=38,x9=39,x10=40,,c1=12, c2=12,w=35, r1=[8.57.47.37.5],r2=[8.57.957.737.67]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!