欢迎光临散文网 会员登陆 & 注册

111

2023-06-14 18:00 作者:狂蘸辣椒酱  | 我要投稿

clear

clc

close all


%% 第一题

% (1)

x = -2:0.001:2;

y = x.*sin(1./x);

plot(x,y);

xlabel('x')

ylabel('y')

title('plot画的图像');

figure

fplot(@(z)z*sin(1./z),[-2 2]);

xlabel('x')

ylabel('y')

title('fplot画的图像');

%(2)

syms m;  

f=m*sin(1/m);  


disp('xsin(1/x)的极限为:');

L=limit(f, m, 0)


%% 第二题

A = [4 2 -1

    3 -1 2

    12 3 0];

B = [2;10;8];

disp('方程组的解为:');

x = inv(A)*B


%% 第三题

% 对sin(x)进行多次求导,并画图查看

syms x1

y = sin(x1);

y1 = diff(y,x1);

y2 = diff(y1,x1);

y3 = diff(y2,x1);

y4 = diff(y3,x1);

y5 = diff(y4,x1);

y6 = diff(y5,x1);

y7 = diff(y6,x1);

y8 = diff(y7,x1);

figure

subplot(411)

ezplot(y,[-4*pi :0.01:4*pi]);

subplot(412)

ezplot(y1,[-4*pi :0.01:4*pi]);

subplot(413)

ezplot(y2,[-4*pi :0.01:4*pi]);

subplot(414)

ezplot(y3,[-4*pi :0.01:4*pi]);

figure

subplot(411)

ezplot(y4,[-4*pi :0.01:4*pi]);

subplot(412)

ezplot(y6,[-4*pi :0.01:4*pi]);

subplot(413)

ezplot(y7,[-4*pi :0.01:4*pi]);

subplot(414)

ezplot(y8,[-4*pi :0.01:4*pi]);


%% 第五题

A = [1 0 0

    -1 0 0

    0 1 0

    0 -1 0

    0 0 1

    0 0 -1];

intcon = [1 2 3 ];

B = [200;-100;150;-80;100;-50];

f = [200 150 180];

[x fval exitflag] = intlinprog(f,intcon,A,B);

disp('产品A B C分别产量为:');

disp(x);

disp('总利润为:');

disp(fval);


111的评论 (共 条)

分享到微博请遵守国家法律