Need help with an integral interval
이전 댓글 표시
hey i have this matlab script that work fine, but i found out that my interval is wrong now i integrate from -d to a. in real i need from -d to a*sin(w*t) where d,a and w is known but t is variable or linspace from 0 to 30. see script bellow: PS need to change F at the bottom.
clear all
clear variables
clc
H100 = 28.6083; % Intermediate Water
C100 = 17.8718;
Tmin = 13.6365;
Tmax = 17.7395;
Tmean = 15.6880;
%--------------------------------------------------------------------------
d = 100; % water depth
T = Tmin; % wave period
a = H100/2; % or C100 % wave amplitude
g = 9.81; % acceleration of gravity
% x = direction of propagation
% t = time
w = 2*pi/T; % wave frequency
syms k
k1 = solve(g*k*tanh(k*d)-w^2 == 0, k);
k = sqrt(k1.^2); % wave number
L = simple(((g*T.^2)*tanh(k*d))/(2*pi)); % wave length
% Morison equation data
D = 1; % Diameter on column: D = 1m= drag, D = 5m= drag/mass, and D = 20m= mass
p = 1025;
Cm = 2;
Cd = 1.1;
%--------------------------------------------------------------------------
% Velocity = V % Acceleration = A
t = linspace(0,30);
x = 0;
syms z
V1 = (((a*k*g*cosh(k*(z+d)))/(w*cosh(k*d)))*sin(w*t-k*x)); % Extrapolation above free surface
V2 = ((a*k*g*cosh(k*(((z-a)/(1+a/d))+d)))/(w*cosh(k*d))*sin(w*t-k*x)); % Wheeler stretching
V3 = (((a*k*g*cosh(k*(0+d)))/(w*cosh(k*d)))*sin(w*t-k*x)); % z = 0 constant value used for surface
A1 = ((a*k*g*cosh(k*(z+d)))/(cosh(k*d)))*cos(w*t-k*x); % Extrapolation above free surface
A2 = ((a*k*g*cosh(k*(((z-a)/(1+a/d))+d)))/(cosh(k*d)))*cos(w*t-k*x); % Wheeler stretching
A3 = ((a*k*g*cosh(k*(0+d)))/(cosh(k*d)))*cos(w*t-k*x); % z = 0 constant value used for surface
%--------------------------------------------------------------------------
% Tmin for H100
Fm = (pi*p*Cm*A1*D.^2)/4;
Fd = ((p*Cd*D)/2)*V1.*(abs(V1));
F = int(Fm,z,-d,a*t)+int(Fd,z,-d,a*t);
[MaxValue_H100_Tmin_Extr, Index_At_F] = max(double(F))
t_Position_of_MaxValue_H100_Tmin_Extr = t(Index_At_F)
% i need to write somthing like( see bellow): but this makes an error.
%a1 = a*sin(w*t);
%F = int(Fm,z,-d,a1)+int(Fd,z,-d,a1);
댓글 수: 4
Konstantinos Sofos
2015년 3월 19일
What is the error? May you have to debug your script, so that you can understand what is going wrong with the dimensions...
ekko ekkosen
2015년 3월 19일
Konstantinos Sofos
2015년 3월 19일
To eval symbolic expressions to specific values of the symbolic variables you can try
F = eval('int(Fm,z,-d,a1)+int(Fd,z,-d,a1)')
ekko ekkosen
2015년 3월 19일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numeric Solvers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!