-
x=linspace(-6,6,100);
y=1./(x.^2+1);
x1=linspace(-6,6,5);
y1=1./(x1.^2+1);
plot(x,y,x1,y1,x1,y1,'o','LineWidth',1.5),
gtext('n=4'),
http://www.codebf.com/read/4/76
-
clear
x=[129 140 103.5 88 185.5 195 105.5 157.5 107.5 77 81 162 162 117.5];
y=[7.5 141.5 23 147 22.5 137.5 85.5 -6.5 -81 3 56.5 -66.5 84 -33.5];
z=[-4 -8 -6 -8 -6 -8 -8 -9 -9 -8 -8 -9 -4 -9];
http://www.codebf.com/read/4/77
-
x=linspace(-6,6,100);
y=1./(x.^2+1);
x1=linspace(-6,6,21);
y1=1./(x1.^2+1);
plot(x,y,x1,y1,x1,y1,'o','LineWidth',1.5),
gtext('n=20'),
http://www.codebf.com/read/4/79
-
load xyz
xi=0:50:5600;
yi=0:50:4800;
zi=interp2(x,y,z,xi,yi','nearest');
surfc(xi,yi,zi)
rotate3d
xlabel('X'),ylabel('Y'),zlabel('Z')
hold on;
plot3(2000,2800,1100,'c.',0,800,650,'r.',4000,2
http://www.codebf.com/read/4/80
-
http://www.codebf.com/read/4/81
-
function y=lagr1(x0,y0,x)
n=length(x0); m=length(x);
for i=1:m
z=x(i);
s=0.0;
for k=1:n
p=1.0;
for j=1:n
if j~=k
p=p*(z-x0(j))/(x0(k)-x0(j));
http://www.codebf.com/read/4/82
-
clear
x0=[-1;1];
A=[];b=[];
Aeq=[1 1];beq=[0];
vlb=[];vub=[];
[x,fval,exitflag,output]=fmincon('fun4',x0,A,b,Aeq,beq,vlb,vub,'mycon')
http://www.codebf.com/read/4/83
-
clear
%x0=[3 5 0 7 0 1 0 0 4 0 6 10 5 1 2 7]';
%x0=[ 3.0000 5.0000 0.0707 7.0000 0 0.9293 0 0 3.9293 0 6.0000 10.0707 6.3875 4.3943
http://www.codebf.com/read/4/84
-
function f=liaoch(x)
a=[1.25 8.75 0.5 5.75 3 7.25];
b=[1.25 0.75 4.75 5 6.5 7.75];
d=[3 5 4 7 6 11];
e=[20 20];
f1=0;
for i=1:6
s(i)=sqrt((x(13)-a(i))^2+(x(14)-b(i))^2);
f1=s(i)*x(i
http://www.codebf.com/read/4/85
-
H=[1 -1; -1 2];
c=[-2 ;-6];
A=[1 1; -1 2];
b=[2;2];
Aeq=[];
beq=[];
VLB=[0;0];VUB=[];
[x,z]=quadprog(H,c,A,b,Aeq,beq,VLB,VUB)
http://www.codebf.com/read/4/86