这篇文章上次修改于 204 天前,可能其部分内容已经发生变化,如有疑问可询问作者。

其实也没啥好写的,就是丢些代码例子。。

Matlab

t = [0.0, 0.3, 0.8, 1.1, 1.6, 2.3]
Y = [0.82, 0.72, 0.63, 0.60, 0.55, 0.5]
A=[ones(size(t)), exp(-t)]
x = A \ Y
n = 500; %数据点数
tt = zeros(n, 1);
yy = zeros(n, 1);
dt = 2.3 / n;
for i = 1 : n
    tt(i) = i * dt;
    yy(i) = x (1) + x(3) * exp(-tt(i));
end
plot(t, y, '*b', tt, yy, 'r')

三维螺旋线

t = 0:0.01:8*pi;
x = cos(t);
y = sin(t);
z= t;
plot3(x, y, z, 'r')

image-20200508212159337.png

三维曲面作图

[x, y] = meshgrid(-3:0.1:3,-4:0.1:4);
z = cos(x) .* sin(y);
mesh(x, y, z);
xlabel('x');
ylabel('y');
zlabel('z');

image-20200508212504785.png

Lingo

min = x1 + x2 + x3 +x4 + x5 +x6;
x1 + x6 >= 60;
x1 + x2 >= 70;
x2 + x3 >= 60;
x3 + x4 = 50;
x4 + x5 >= 20;
x5 + x6 >= 30;

image-20200510165836830.png

求得最小为 150

sets:
person/1..4/;
task/1..4/;
assign(person, task):a,x;
endsets

data:
a = 1100, 800, 1000, 700, 600,500,300,800,400,800,1000,900,1100,1000,500,700;
enddata

min = @sum(assign:a*x);
@for(task(j):@sum(person(i):x(i,j))=1);
@for(person(i):@sum(task(j):x(i,j))=1);
@for(assign(i,j):@bin(x(i,j)));

image-20200510171308030.png
image-20200510172439432.png


Today is over