matlab矩阵求解

来源:百度知道 编辑:UC知道 时间:2024/05/26 08:40:35
L = 1046.95; % L is the total distance for the beam.
% The unit for L is mm

A = 1031.95; % A = l3 is the distance form the diagram.
B = 866.85; % B = l2 is the distance form the diagram.
D = 581.05; % D = l1 is the distance form the diagram.
% The unit for l1,l2 & l3 are mm

E = 209; % E is modulus of elasticity, elliptic integral of the second kind.
% The unit for E is GPa

I = 91934.0; % I is moment of inertia of a plane area. If w choose the constants diameter for d1=6mm and d2=37mm
% The unit for I is mm.
N = input('please enter the value for N=') % N is finite elements
h = L/N % h is width
c = input('Please enter the value for i=');
if (0<=c)&(c<=N)
else
error('The i over the range.')
end
for i=0:c

x=i*h; % x is measure downwards from the fixture at the top.

Ma = 1; % bending moment when x = l3. The unit for Ma is Nm.

C

matlab编程的时候最好有一个习惯,
把不想输出的语句后面加上分号

你之所以会出现这样的结果是这样的:
for i=0:c

x=i*h; % x is measure downwards from the fixture at the top.

Ma = 1; % bending moment when x = l3. The unit for Ma is Nm.

C=[];
C=[C;-(h^2*(L-x)/(E*I))]
(你后面还没有一个end语句)

最后一句你加个分号

另外把循环里面的C=[]调到循环前面
就可以了

你试试看

L = 1046.95; % L is the total distance for the beam.
% The unit for L is mm

A = 1031.95; % A = l3 is the distance form the diagram.
B = 866.85; % B = l2 is the distance form the diagram.
D = 581.05; % D = l1 is the distance form the diagram.
% The unit for l1,l2 & l3 are mm

E = 209; % E is modulus of elasticity, elliptic integral of the second kind.
% The unit for E is GPa

I = 91934.0; % I is moment of inertia of a plane area. If w choose the constants diameter for d1=6mm and d2=37mm
% The unit for I is mm.
N = input(