基于MATLAB语言的地震波浪力的可视化程序TJU.EWF |
||||||||||
可视化地震诱发波浪力模拟小程序TJU.EWF
(MATLAB2012-b语言, Lcc 编译)
天津大学 建筑工程学院 ; 天津大学 前沿技术研究院; 国家重点实验室-水利工程仿真与安全
更多程序下载 图1 TJU.EWF(Earthquake-induced Wave Force)程序界面 图2 波浪力时程与波高谱
【TJU.EWF的功能和特点】:
1. 界面友好,简单、直接、实用。
function varargout = Wave_force_simulation(varargin)
% WAVE_FORCE_SIMULATION M-file for Wave_force_simulation.fig
% WAVE_FORCE_SIMULATION, by itself, creates a new WAVE_FORCE_SIMULATION or raises the existing
% singleton*.
%
% H = WAVE_FORCE_SIMULATION returns the handle to a new WAVE_FORCE_SIMULATION or the handle to
% the existing singleton*.
%
% WAVE_FORCE_SIMULATION('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in WAVE_FORCE_SIMULATION.M with the given input arguments.
%
% WAVE_FORCE_SIMULATION('Property','Value',...) creates a new WAVE_FORCE_SIMULATION or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Wave_force_simulation_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Wave_force_simulation_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to kaka (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Wave_force_simulation
% Last Modified by GUIDE v2.5 19-May-2013 11:52:53
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Wave_force_simulation_OpeningFcn, ...
'gui_OutputFcn', @Wave_force_simulation_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Wave_force_simulation is made visible.
function Wave_force_simulation_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Wave_force_simulation (see VARARGIN)
% Choose default command line output for Wave_force_simulation
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Wave_force_simulation wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Wave_force_simulation_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on selection change in earthquake_magnitude.
function earthquake_magnitude_Callback(hObject, eventdata, handles)
% hObject handle to earthquake_magnitude (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns earthquake_magnitude contents as cell array
% contents{get(hObject,'Value')} returns selected item from earthquake_magnitude
% --- Executes during object creation, after setting all properties.
function earthquake_magnitude_CreateFcn(hObject, eventdata, handles)
% hObject handle to earthquake_magnitude (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Haixiao_grade_Callback(hObject, eventdata, handles)
% hObject handle to Haixiao_grade (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Haixiao_grade as text
% str2double(get(hObject,'String')) returns contents of Haixiao_grade as a double
% --- Executes during object creation, after setting all properties.
function Haixiao_grade_CreateFcn(hObject, eventdata, handles)
% hObject handle to Haixiao_grade (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Haixiao_Hup_Callback(hObject, eventdata, handles)
% hObject handle to Haixiao_Hup (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Haixiao_Hup as text
% str2double(get(hObject,'String')) returns contents of Haixiao_Hup as a double
% --- Executes during object creation, after setting all properties.
function Haixiao_Hup_CreateFcn(hObject, eventdata, handles)
% hObject handle to Haixiao_Hup (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function alpha_Callback(hObject, eventdata, handles)
% hObject handle to alpha (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of alpha as text
% str2double(get(hObject,'String')) returns contents of alpha as a double
% --- Executes during object creation, after setting all properties.
function alpha_CreateFcn(hObject, eventdata, handles)
% hObject handle to alpha (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function beta_Callback(hObject, eventdata, handles)
% hObject handle to beta (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of beta as text
% str2double(get(hObject,'String')) returns contents of beta as a double
% --- Executes during object creation, after setting all properties.
function beta_CreateFcn(hObject, eventdata, handles)
% hObject handle to beta (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function fm_Callback(hObject, eventdata, handles)
% hObject handle to fm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of fm as text
% str2double(get(hObject,'String')) returns contents of fm as a double
% --- Executes during object creation, after setting all properties.
function fm_CreateFcn(hObject, eventdata, handles)
% hObject handle to fm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in judgement.
function judgement_Callback(hObject, eventdata, handles)
% hObject handle to judgement (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns judgement contents as cell array
% contents{get(hObject,'Value')} returns selected item from judgement
% --- Executes during object creation, after setting all properties.
function judgement_CreateFcn(hObject, eventdata, handles)
% hObject handle to judgement (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function wm_Callback(hObject, eventdata, handles)
% hObject handle to wm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of wm as text
% str2double(get(hObject,'String')) returns contents of wm as a double
% --- Executes during object creation, after setting all properties.
function wm_CreateFcn(hObject, eventdata, handles)
% hObject handle to wm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function f_bottom_Callback(hObject, eventdata, handles)
% hObject handle to f_bottom (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of f_bottom as text
% str2double(get(hObject,'String')) returns contents of f_bottom as a double
% --- Executes during object creation, after setting all properties.
function f_bottom_CreateFcn(hObject, eventdata, handles)
% hObject handle to f_bottom (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function f_up_Callback(hObject, eventdata, handles)
% hObject handle to f_up (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of f_up as text
% str2double(get(hObject,'String')) returns contents of f_up as a double
% --- Executes during object creation, after setting all properties.
function f_up_CreateFcn(hObject, eventdata, handles)
% hObject handle to f_up (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function time_Callback(hObject, eventdata, handles)
% hObject handle to time (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of time as text
% str2double(get(hObject,'String')) returns contents of time as a double
% --- Executes during object creation, after setting all properties.
function time_CreateFcn(hObject, eventdata, handles)
% hObject handle to time (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function tezhengchicun_Callback(hObject, eventdata, handles)
% hObject handle to tezhengchicun (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of tezhengchicun as text
% str2double(get(hObject,'String')) returns contents of tezhengchicun as a double
% --- Executes during object creation, after setting all properties.
function tezhengchicun_CreateFcn(hObject, eventdata, handles)
% hObject handle to tezhengchicun (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function jingshuishendu_Callback(hObject, eventdata, handles)
% hObject handle to jingshuishendu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of jingshuishendu as text
% str2double(get(hObject,'String')) returns contents of jingshuishendu as a double
% --- Executes during object creation, after setting all properties.
function jingshuishendu_CreateFcn(hObject, eventdata, handles)
% hObject handle to jingshuishendu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function jisuangaodu_Callback(hObject, eventdata, handles)
% hObject handle to jisuangaodu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of jisuangaodu as text
% str2double(get(hObject,'String')) returns contents of jisuangaodu as a double
% --- Executes during object creation, after setting all properties.
function jisuangaodu_CreateFcn(hObject, eventdata, handles)
% hObject handle to jisuangaodu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function pinlvdianshu_Callback(hObject, eventdata, handles)
% hObject handle to pinlvdianshu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
pinlvdianshu=num2str(get(handles.pinlvdianshu,'value')); %%% 滑动条控制频率点
nn=str2num(pinlvdianshu);
set(handles.pinlvdianshu_show,'String',nn); %%% 赋值给界面显示
% --- Executes during object creation, after setting all properties.
function pinlvdianshu_CreateFcn(hObject, eventdata, handles)
% hObject handle to pinlvdianshu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function pinlvdianshu_show_Callback(hObject, eventdata, handles)
% hObject handle to pinlvdianshu_show (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of pinlvdianshu_show as text
% str2double(get(hObject,'String')) returns contents of pinlvdianshu_show as a double
% --- Executes during object creation, after setting all properties.
function pinlvdianshu_show_CreateFcn(hObject, eventdata, handles)
% hObject handle to pinlvdianshu_show (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function shijianjiange_Callback(hObject, eventdata, handles)
% hObject handle to shijianjiange (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of shijianjiange as text
% str2double(get(hObject,'String')) returns contents of shijianjiange as a double
% --- Executes during object creation, after setting all properties.
function shijianjiange_CreateFcn(hObject, eventdata, handles)
% hObject handle to shijianjiange (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function action_area_Callback(hObject, eventdata, handles)
% hObject handle to action_area (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of action_area as text
% str2double(get(hObject,'String')) returns contents of action_area as a double
% --- Executes during object creation, after setting all properties.
function action_area_CreateFcn(hObject, eventdata, handles)
% hObject handle to action_area (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in Run.
function Run_Callback(hObject, eventdata, handles)
% hObject handle to Run (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
judgement=get(handles.judgement,'Value')
switch judgement %%% 一级switch
case 1 %%% 一级判断
number=get(handles.earthquake_magnitude,'Value');
switch number %%% 二级switch
case 1 %%% 二级判断
ML=6.0;
Grade=-2;
Hup=0.3;
set(handles.Haixiao_grade,'String','-2')
set(handles.Haixiao_Hup,'String','0.3')
case 2
ML=6.5;
Grade=-1;
Hup=0.7;
set(handles.Haixiao_grade,'String','-1')
set(handles.Haixiao_Hup,'String','0.7')
case 3
ML=7.0;
Grade=0;
Hup=1.5;
set(handles.Haixiao_grade,'String','0')
set(handles.Haixiao_Hup,'String','1.5')
case 4
ML=7.5;
Grade=1;
Hup=3;
set(handles.Haixiao_grade,'String','1')
set(handles.Haixiao_Hup,'String','3')
case 5
ML=8.0;
Grade=2;
Hup=6;
set(handles.Haixiao_grade,'String','2')
set(handles.Haixiao_Hup,'String','6')
case 6
ML=8.75;
Grade=4;
Hup=24;
set(handles.Haixiao_grade,'String','4')
set(handles.Haixiao_Hup,'String','24')
end
case 2
number=get(handles.earthquake_magnitude,'Value');
switch number
case 1
ML=6.0;
Grade=-2;
Hup=str2num(get(handles.Haixiao_Hup,'string')) ;
set(handles.Haixiao_grade,'String','-2');
set(handles.Haixiao_Hup,'String',Hup);
case 2
ML=6.5;
Grade=-1;
Hup=str2num(get(handles.Haixiao_Hup,'string')) ;
set(handles.Haixiao_grade,'String','-1');
set(handles.Haixiao_Hup,'String',Hup);
case 3
ML=7.0;
Grade=0;
Hup=str2num(get(handles.Haixiao_Hup,'string')) ;
set(handles.Haixiao_grade,'String','0')
set(handles.Haixiao_Hup,'String',Hup);
case 4
ML=7.5;
Grade=1;
Hup=str2num(get(handles.Haixiao_Hup,'string')) ;
set(handles.Haixiao_grade,'String','1')
set(handles.Haixiao_Hup,'String',Hup);
case 5
ML=8.0;
Grade=2;
Hup=str2num(get(handles.Haixiao_Hup,'string')) ;
set(handles.Haixiao_grade,'String','2')
set(handles.Haixiao_Hup,'String',Hup);
case 6
ML=8.75;
Grade=4;
Hup=str2num(get(handles.Haixiao_Hup,'string')) ;
set(handles.Haixiao_grade,'String','4')
set(handles.Haixiao_Hup,'String',Hup);
end %%%% 二级结束
end %%% 一级结束
alpha=str2num(get(handles.alpha,'string')); %%% 索取无量纲因子alpha
beta=str2num(get(handles.beta,'string')); %%% 索取无量纲因子alpha
wm=1.253/(Hup)^0.5;
set(handles.wm,'String',wm);
fm=wm/(2*pi);
set(handles.fm,'String',fm);
%%%%%%%%%%% 定义震级参数与浪高谱参数结束 %%%%%%%%%%%%%%%
%%%%%%%%%%%% 依据P-M谱 计算有效浪高频域谱 %%%%%%%%%%%%%%
f_bottom=str2num(get(handles.f_bottom,'string')); %%% 获取 频段下限
w_bottom=2*3.14*f_bottom;
f_up=str2num(get(handles.f_up,'string')); %%% 获取 频段上限
w_up=2*3.14*f_up;
pinlvdianshu=num2str(get(handles.pinlvdianshu,'value')); %%% 滑动条控制频率点
nf=str2num(pinlvdianshu); %%% 频率点数
nw=nf;
deta_f=(f_up-f_bottom)/(nf-1); %%% 频率间隔
deta_w=2*3.14*deta_f;
time=str2num(get(handles.time,'string')); %%% 获取 模拟时间
deta_t=str2num(get(handles.shijianjiange,'string')); %%% 时间间隔
nt=(time/deta_t)+1; %%% 时间个数
DD=str2num(get(handles.tezhengchicun,'string')); %%% 获取 特征尺寸
dd=str2num(get(handles.jingshuishendu,'string')); %%% 获取 净水深度
zz=str2num(get(handles.jisuangaodu,'string')); %%% 获取 计算点高度
AA=str2num(get(handles.action_area,'string')); %%% 获取 有效作用面积
Lm=(4/3)*((9.8*pi)/(wm^2)); %%% 意义平均波长
kk=2*pi/Lm; %%% 2pi弧度上的波数
gama=1000*9.8; %%% 水的密度*9.8m/s/s
cm=2.0; %%% 圆形横截面的惯性力系数
cd=1.2; %%% 圆形横截面的速度力系数
for j=1:1:nw
SHW(j)=((alpha*9.8^2)/(j*deta_w)^5)*exp(-beta*(wm/(j*deta_w)^4));
HW(j)=(2*SHW(j)*deta_w)^0.5;
end
w=w_bottom:deta_w:w_up;
mianji=trapz(w,SHW); %%% 被积函数 计算有效波高
lanmada=Hup/mianji;
figure('Name','浪高谱-圆频率','NumberTitle','off')
h1=plot (w_bottom:deta_w:w_up,SHW,'r')
set(gcf,'Position',[300,160,500,270])
set(h1,'LineWidth',2)
xlim([0 w_up])
xlabel('Circular Frequency / (Rad/s)')
ylabel('PSD / m^2/(Rad/s)');
set(h1,'LineWidth',1.5)
grid on;
figure('Name','浪高谱-频率','NumberTitle','off')
h2=plot (f_bottom:deta_f:f_up,2*3.14*SHW,'r')
set(gcf,'Position',[480,60,500,270])
set(h2,'LineWidth',2)
xlim([0 f_up])
xlabel('Frequency / Hz')
ylabel('PSD / m^2/Hz');
set(h2,'LineWidth',1.5)
grid on;
%%%%%%%%%%%% 依据P-M谱 计算有效浪高频域谱 %%%%%%%%%%%%%%%
%%%%%%%%%%%% 计算波浪力和等效波浪压力 %%%%%%%%%%%%%%%
fai_w=2*pi*rand(nw,1); %% 在【0,2pi】范围内生成随机相位角
for j=1:1:nw
for k=1:1:nt; %% t=0:deta_t:time
Fimax(j)=cm*(gama*pi*DD^2*kk*Hup/8)*(cosh(kk*(zz+dd))/cosh(kk*dd)); %%% 惯性力峰值
Fi(j,k)=Fimax(j)*sin((j-1)*deta_w*(k-1)*deta_t+fai_w(j));
Fvmax(j)=cd*(gama*DD*kk*(Hup)^2/4)*((cosh(kk*(zz+dd))^2)/sinh(2*kk*dd)); %%% 速度力峰值
Fv(j,k)=Fvmax(j)*cos((j-1)*deta_w*(k-1)*deta_t++fai_w(j))*abs(cos((j-1)*deta_w*(k-1)*deta_t)++fai_w(j));
end
end
Fi=sum(Fi(:,:));
Fv=sum(Fv(:,:));
F=-Fi+Fv;
F(1)=0;
P=F/AA;
figure ('Name','波浪作用-力','NumberTitle','off')
h3=plot(0:deta_t:time,F)
set(gcf,'Position',[620,30,500,270])
set(h3,'LineWidth',2)
xlim([0 time])
xlabel('Time / s')
ylabel('Force / N');
set(h2,'LineWidth',1.5)
grid on;
figure ('Name','波浪作用-面压','NumberTitle','off')
h4=plot(0:deta_t:time,P)
set(gcf,'Position',[750,0,500,270])
set(h4,'LineWidth',1.5)
xlim([0 time])
xlabel('Time / s')
ylabel('Pressure / Pa');
set(h2,'LineWidth',1.5)
grid on;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 数据输出 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% 波浪作用数据,保存到MATLAB运行目录
tt=0:deta_t:time;
data_WFS_force=[tt',F'];
data_WFS_pressure=[tt',P'];
dlmwrite('柳国环_波浪力.xls',data_WFS_force)
dlmwrite('柳国环_波浪压力.xls',data_WFS_pressure)
dlmwrite('柳国环_波浪力.txt',data_WFS_force)
dlmwrite('柳国环_波浪压力.txt',data_WFS_pressure)
%%%%%% 波浪作用数据,保存到桌面 (你可别告诉我,你没有C盘)
mkdir('C:\Documents and Settings\Administrator\桌面\柳国环')
save('C:\Documents and Settings\Administrator\桌面\柳国环\Liugh_波浪力.xls','data_WFS_force','-ASCII')
save('C:\Documents and Settings\Administrator\桌面\柳国环\Liugh_波浪力.txt','data_WFS_force','-ASCII')
save('C:\Documents and Settings\Administrator\桌面\柳国环\Liugh_波浪压力.xls','data_WFS_pressure','-ASCII')
save('C:\Documents and Settings\Administrator\桌面\柳国环\Liugh_波浪压力.txt','data_WFS_pressure','-ASCII')
%%%%%% 波浪作用数据
【程序及其使用说明下载】:
本程序免费下载 / 欢迎提出宝贵意见 / 敬请尊重劳动成果
天津大学 建筑工程学院 ; 天津大学 前沿技术研究院; 国家重点实验室-水利工程仿真与安全
|