About Mat lab Code

2 次查看(过去 30 天)
Mantri
Mantri 2012-4-10
clc; clear all
m=1.1281e4;
I = [3.186e4 0 -546.3943; 0 8.7571e4 0; -546.3943 0 1.2235e5]; % Mass moment of inertia
Ixx = I(1,1);
Iyy = I(2,2);
Izz = I(3,3);
Ixy = I(1,2);
Iyx = I(2,1);
Ixz = I(1,3);
Izx = I(3,1);
Iyz = I(2,3);
Izy = I(3,2);
g=9.80665; % m/s^2
Cdo=0.0077;
Csda= -0.031;
Clo=0.062;
Cla=2.09;
Clde= 0.594;
Clda= -0.13;
Cldr=-0.004;
Cmo=-0.003;
Cma=-0.024;
Cmde=-0.169;
Cnda=-0.017;
Cndr=-0.018;
rho=1.225; % kg/m^3
s=75.1214; % m^2
b=11.43; % m
c=8.763; % m
lx=-5.715; % m
lz=0.1777; % m
di=3*pi/180; %radian
Tmax= 3.6849e4; %[Nt]
syms da de dr u0 zeta
% clear sym da
% clear sym de
% clear sym dr
% clear sym u0
% clear sym zeta
alpha=0;
beta=0;
u=u0;
v=0;
w=0;
V=sqrt(u^2+v^2+w^2);
% Rotation Matrix
Rbw=[cos(alpha)*cos(beta),-cos(alpha)*sin(beta),-sin(alpha);
sin(beta),cos(beta),0;
sin(alpha)*cos(beta),-sin(beta)*sin(alpha),cos(alpha)];
% Aerodynamic force components
CD=Cdo;
CS=Csda*da;
CL=Clo+Cla*alpha+Clde*de;
% Aerodynamic drag,side force and lift
D=0.5*rho*V^2*s*CD;
S=0.5*rho*V^2*s*CS;
L=0.5*rho*V^2*s*CL;
DSL=[-D;-S;-L];
% Propulsive Force (Thrust) components
T=zeta*Tmax;
Tx=T*cos(di);
Tz=-T*sin(di);
Txyz=[Tx;0;Tz];
% AeroDynamic Force in body frame
F=Rbw*DSL+Txyz;
Fx=F(1,1);
Fy=F(2,1);
Fz=F(3,1);
% Aerodynamic Moment coefficient
CLm=Clda*da+Cldr*dr;
CM=Cmo+Cma*alpha + Cmde*de;
CN=Cnda*da+Cndr*dr;
% Roll, Pitch and Yaw moments due to aerodynamics and propulsion
LM=0.5*rho*V^2*s*b*CL;
M=0.5*rho*V^2*s*c*CM+Tx*lz-Tz*lx;
N=0.5*rho*V^2*s*b*CN;
Eq1 = -D*cos(alpha)*cos(beta)+S*cos(alpha)*sin(beta)+L*sin(alpha)+Tx;
Eq2 = -D*sin(beta)- S*cos(beta);
Eq3 = -D*sin(alpha)*cos(beta)+S*sin(alpha)*sin(beta)-L*cos(alpha)+Tz+m*g;
Eq4 = 0.5*rho*V^2*s*b*CL;
Eq5 = 0.5*rho*V^2*s*c*CM+Tx*lz-Tz*lx;
Eq6 = 0.5*rho*V^2*s*b*CN;
[Solution] = solve(Eq1,Eq2,Eq3,Eq4,Eq5,Eq6)
returns
Solution =
[ empty sym ]
how can I get to solve the equations. I did check each equations separately and they they work all individually. Can somebody help me out please ???
  1 个评论
Geoff
Geoff 2012-4-10
Please edit your question, highlight all the code and press the {} Code button in the editor toolbar. Then save it, and we'll be able to read it!

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2012-4-10
You have 6 equations in 5 variables, so your system is overdetermined and there might not be any answer.
Are you sure that you want Eq4 and Eq6 to contain only multiplications? Recall that solve() implicitly solves each expression for being equal to 0, so the effect of those two equations is to force at least one sub-expression to be 0. All the sub-expressions are constants except for CL and CN, and if your intent is to force those to be 0 it would be much clearer to just name them without the multipliers.

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by