www.pudn.com > ship.zip > script.asv, change:2016-09-01,size:1246b


%% 初始化 
clc 
close all 
clear all 
format shortg 
%% 输入数据 
global L Lw B d Cwa Cp Cb m Iz rou V n Dp Cpp  H wp wr P AR Xuu Xvr Xvv Xrr Yv  Yvr Yvv Yrr Yvrr Yvvr Nv  Nr Nvv Nvvr Nvrr m mx my Jz Iz 
L=5.110;%船长 
Lw=5.000;%设计水线长 
B=0.729;%型宽 
d=0.158;%设计吃水 
Cwa=0.74;%水线面系数 
Cp=0.59;%菱形系数 
Cb=0.55;%方形系数 
m=321.2;%船模质量 
Iz=524.428;%转动惯量 
rou=1;%水密度 
V=1.38;%船舶速度 
n=1070;%转速 
Dp=0.128;%桨直径 
Cpp=0.10;%两桨距离的一半 
H=0.10;%舵高 
P=0.133;%螺距 
AR=9.71*10^(-3);%舵面积 
 
Xuu = 0.2662; 
Xvr = -1.2557e+03; 
Xvv = -1.7885; 
Xrr =3.3078; 
Yv = -3.7834; 
Yr = 440.5878; 
Yvr = 10; %%% 需要输入 
Yvv = 31.3088; 
Yrr = 0.9757; 
Yvrr = -141.3138; 
Yvvr = 0.9757; 
Nv = -5.7760; 
Nr = -14.1131; 
Nvv = 1.8433; 
Nrr = -88.4434; 
Nvrr = -13.3994; 
Nvvr = 3.0399e+03; 
m = 321.2; 
mx =1.3587; 
my = 40.9595; 
Jz = 2.1962e+03; 
Iz = 524.4280; 
% delta = @fcn_delta; % 
% duo   = @duo; 
% luoxuanjiang = @luoxuanjiang; 
 
u0 = 1.1; 
v0 = 1; 
r0 = 0; 
 
%% ode 
tspan = [1  500]; % Solve from t=1 to t=5 
Y0 = [u0 v0 r0]; 
[T,Y] = ode45(@(t,x) f(t,x,@fcn_delta,@duo,@luoxuanjiang),tspan,Y0);% Solve ODE 
 
semilogy(T, Y); 
title('u(t),v(t),r(t)'); 
xlabel('t'); ylabel('u(t),v(t),r(t)'); 
legend('u','v','r')