1)
A=[7,2,1,-2;9,15,3,-2;-2,-2,11,5,;1,3,2,13];
b=[4,7,-1,0]';
[L,U]=lu(A);
x=U\(L\b)
2)
A=[5,7,6,5,1;7,10,8,7,2;6,8,10,9,3;5,7,9,10,4;1,2,3,4,5];
b=[24,96;34,136;36,144;35,140;15,60];
[L,U]=lu(A);
x=U\(L\b)
3 .1
% 表示该方程组
dy = @(t, y)[y(2)*y(3); -1*y(1)*y(3);-0.51*y(1)*y(2)];
y10 = 0;
y20 = 1;
y30 = 1;
tspan = [2, 10*pi]; %区间可根据实际需求自行改变
[t_1, y_1] = ode45(dy, tspan, [y10, y20,y30]);
% plot
subplot(1, 2, 1);
plot(t_1, y_1(:, 2));
title('dy/dt')
subplot(1, 2, 2);
plot(t_1, y_1(:, 1));
title('y')
参考
http://t.csdn.cn/lEBOVhttp://t.csdn.cn/lEBOV
http://t.csdn.cn/JOBnMhttp://t.csdn.cn/JOBnM
3 .2
% 表示该方程组
dx = @(t, x)[x(2); -1999*x(1)];
x10 = 2;
x20 = 0;
tspan = [2,100];
[t_1, x_1] = ode45(dx, tspan, [x10, x20]);
% plot
subplot(1, 2, 1);
plot(t_1, x_1(:, 2));
title('dx/dt')
subplot(1, 2, 2);
plot(t_1, x_1(:, 1));
title('x')
num = [10];
den = [1 8 36 0 10];
G = tf(num,den)
step(G)