Need help with an integral interval

3 views (last 30 days)
ekko ekkosen
ekko ekkosen on 19 Mar 2015
Commented: ekko ekkosen on 19 Mar 2015
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 Comments
Konstantinos Sofos
Konstantinos Sofos on 19 Mar 2015
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
ekko ekkosen on 19 Mar 2015
F = eval('int(Fm,z,-d,a1)+int(Fd,z,-d,a1)')
dosent work for me.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!